detecting MS Edge as html::$user_agent="edge" and html::$ua_version="12.*", even if some report only "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"

This commit is contained in:
Ralf Becker 2015-10-26 21:42:25 +00:00
parent ac6dbad373
commit 5e8781078c

View File

@ -69,7 +69,7 @@ class html
$parts = array_pop($all_parts);
foreach($all_parts as $p)
{
if ($p[1] == 'Chrome')
if ($p[1] == 'Chrome' && $parts[1] != 'Edge')
{
$parts = $p;
break;
@ -91,6 +91,12 @@ class html
{
self::$user_agent = 'firefox';
}
// MS Edge sometimes reports just "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
if (self::$user_agent == 'mozilla' && self::$ua_version == '5.0')
{
self::$user_agent = 'edge';
self::$ua_version = '12.0';
}
self::$ua_mobile = preg_match('/(iPhone|iPod|iPad|Android|SymbianOS|Blackberry|Kindle|Opera Mobi|Windows Phone)/i',
$_SERVER['HTTP_USER_AGENT'], $matches) ? strtolower($matches[1]) : null;