Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
/**
* Браузер
* @return mixed браузер, бот или false если не определен
*/
function browser() {
global $HTTP_USER_AGENT;
if (empty($HTTP_USER_AGENT)):
if (!empty($_SERVER) && isset($_SERVER['HTTP_USER_AGENT'])): $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
elseif (@getenv('HTTP_USER_AGENT')): $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT');
endif;
endif;
$browser = array(
// браузеры
"msie" => "Internet Explorer",
"opera" => "Opera", "mozilla" => "Mozilla",
"firebird" => "Mozilla Firebird",
"firefox" => "Mozilla Firefox",
"go!zilla" => "Go!Zilla", "konqueror" => "Konqueror",
"teleport" => "TelePort Pro",
"webcapture" => "Acrobat",
"webcopier" => "WebCopier",
// телефоны
"alcatel" => "Alcatel Browser (PDA/Phone browser)",
"mot-" => "Motorola Browser (PDA/Phone browser)",
"nokia" => "Nokia Browser (PDA/Phone browser)", "panasonic" => "Panasonic Browser (PDA/Phone browser)",
"philips" => "Philips Browser (PDA/Phone browser)", "sonyericsson" => "Sony/Ericsson Browser (PDA/Phone browser)",
"docomo" => "I-Mode phone (PDA/Phone browser)", "portalmmm" => "I-Mode phone (PDA/Phone browser)",
// валидаторы
"csscheck" => "WDG CSS Validator",
"w3m" => "W3M Validator",
"w3c_css_validator" => "W3C CSS Validator",
"w3c_validator" => "W3C HTML Validator",
"wdg_validator" => "WDG HTML Validator",
// поисковики
"Yandex" => "Yandex",
"google" => "Google",
"Googlebot" => "Google",
"Mediapartners-Google" => "Google",
"StackRambler" => "Rambler",
"stack" => "Rambler",
"rambler" => "Rambler",
"Mail.Ru" => "Mail.Ru",
"meta" => "Meta",
"fast" => "Fast",
"aport" => "Aport",
"yahoo" => "Yahoo",
"Yahoo-MMCrawler" => "Yahoo",
"lycos" => "Lycos",
"MSNBot" => "MNS\Live",
"Teoma" => "ASK",
"ia_archiver" => "Alexa",
"Crawler/2.0" => "WebAlta",
"Slurp" => "Slurp",
"Wget" => "Wget",
"WebCrawler" => "WebCrawler",
"ZyBorg" => "ZyBorg",
"scooter" => "AltaVista",
);
if (preg_match("/msie[\/\sa-z]*([\d\.]*)/i", $HTTP_USER_AGENT, $matches) && !preg_match("/webtv/i", $HTTP_USER_AGENT) && !preg_match("/opera/i", $HTTP_USER_AGENT)): return "Internet Explorer " . $matches[1];
elseif (preg_match("/netscape.?\/([\d\.]*)/i", $HTTP_USER_AGENT, $matches)): return "Netscape " . $matches[1];
elseif (preg_match("/mozilla[\/\sa-z]*([\d\.]*)/i", $HTTP_USER_AGENT, $matches) && !preg_match("/compatible/i", $HTTP_USER_AGENT) && !preg_match("/opera/i", $HTTP_USER_AGENT)): return "Netscape " . $matches[2];
else:
foreach ($browser as $key => $string):
if (preg_match("/$key.?\/([\d\.]*)/i", $HTTP_USER_AGENT, $matches)): return $browser[$key] . " " . $matches[1];
endif;
endforeach;
endif;
return $HTTP_USER_AGENT;
}