1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Merge pull request #20 from MartinodF/patch-1

Add IE11 support + avoid exception when unable to match UA
This commit is contained in:
Dustin Diaz 2013-08-16 12:54:38 -07:00
commit eb7a857e5f

View File

@ -9,6 +9,7 @@
* Opera: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; en) Presto/2.7.62 Version/11.01"
* Safari: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"
* IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)"
* IE>=11: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko"
* Firefox: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0"
* iPhone: "Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5"
* iPad: "Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5",
@ -19,7 +20,7 @@
var ua = navigator.userAgent
, t = true
, ie = /msie/i.test(ua)
, ie = /(msie|trident)/i.test(ua)
, chrome = /chrome/i.test(ua)
, phantom = /phantom/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom
@ -39,7 +40,7 @@
if (ie) return {
msie: t
, version: ua.match(/msie (\d+(\.\d+)?);/i)[1]
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
}
if (opera) return {
opera: t
@ -98,6 +99,7 @@
seamonkey: t
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
}
return {}
}
var bowser = detect()