Тэг "Browser" (5)
Force the browser to download the file instead of opening it ... Показать код
$file_text = 'Some text here';
if (isset($_SERVER['HTTP_USER_AGENT']) and strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE'))
Header('Content-Type: application/force-download');
else
Header('Content-Type: application/octet-stream');
Header('Accept-Ranges: bytes');
Header('Content-Length: ' . strlen($file_text));
Header('Content-disposition: attachment; filename="downloaded_file.txt"');
echo $file_text;
exit();
Fix for Internet Explorer 5.5/6/7/8 to render HTML5 documents and websites normally. Place this code into the
of document. ... Показать код
Determination of the browser and its version by user-agent string. ... Показать код
function user_browser($agent) {
preg_match("/(MSIE|Opera|Firefox|Chrome|Version|Opera Mini|Netscape|Konqueror|SeaMonkey|Camino|Minefield|Iceweasel|K-Meleon|Maxthon)(?:\/| )([0-9.]+)/", $agent, $browser_info);
list(, $browser, $version) = $browser_info;
if (preg_match("/Opera ([0-9.]+)/i", $agent, $opera))
return 'Opera|' . $opera[1];
if ($browser == 'MSIE') {
preg_match("/(Maxthon|Avant Browser|MyIE2)/i", $agent, $ie);
if ($ie)
return $ie[1] . ' based on IE|' . $version;
return 'IE|' . $version;
}
if ($browser == 'Firefox') {
preg_match("/(Flock|Navigator|Epiphany)\/([0-9.]+)/", $agent, $ff);
if ($ff)
return $ff[1] . '|' . $ff[2];
}
if ($browser == 'Opera' && $version == '9.80')
return 'Opera|' . substr($agent, -5);
if ($browser == 'Version')
return 'Safari|' . $version;
if (!$browser && strpos($agent, 'Gecko'))
return 'Browser based on Gecko';
return $browser . '|' . $version;
}
rotate(obj, degree) ... Показать код
function rotate(obj, degree) {
$(obj).animate({
'-webkit-transform': 'rotate(' + degree + 'deg)',
'-moz-transform': 'rotate(' + degree + 'deg)',
'-ms-transform': 'rotate(' + degree + 'deg)',
'-o-transform': 'rotate(' + degree + 'deg)',
'transform': 'rotate(' + degree + 'deg)',
'zoom': 1
}, 5000);
}
CSS: Cross-browser transparency
Cross-browser transparency. Works equally well in IE, FF, Chrome, Safari and Opera. ... Показать код
.transp-element {
filter: alpha(opacity=80); /* IE */
-khtml-opacity: 0.8; /* Safari (old) */
-moz-opacity: 0.8; /* FF */
opacity: 0.8; /* FF, Safari, Opera */
}
Open URL in a default browser ... Показать код
uses Winapi.ShellAPI;
...
procedure OpenURL(url:string);
begin
ShellExecute(Handle, 'open', pChar(url), nil, nil, SW_NORMAL);
end;
CSS: Box shadow
Cross-browser CSS box shadow ... Показать код
-webkit-box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4);
box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4);
CSS: Rounded corners
Cross-browser CSS rounded corners ... Показать код
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;