Skip to content

Commit 1d3c151

Browse files
committed
1. Added support for Firefox 3.6, Windows Vista, iPad, BlackBerry and Android.
2. Changed J2ME device selector from "mobile" to "j2me" 3. Appended the generic selector "mobile" to all applicable mobile devices (J2ME, BlackBerry, iPhone, iPod)
1 parent 0946776 commit 1d3c151

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

css_browser_selector.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tester.html

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13", "webkit chrome win"],
2727
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13", "webkit chrome win"],
2828
// Firefox
29+
["mozilla/5.0 (macintosh; u; intel mac os x 10.6; en-us; rv:1.9.2.3) gecko/20100401 firefox/3.6.3 gtb7.0", "gecko ff3 ff3_6 mac"], //firefox 3.6 mac
2930
["mozilla/5.0 (macintosh; u; intel mac os x 10.5; en-gb; rv:1.9.1) gecko/20090624 firefox/3.5" , "gecko ff3 ff3_5 mac"], // firefox 3.5 mac
3031
["Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" , "gecko ff2 mac"], // firefox 2 mac
3132
["Mozilla/5.0 (X11; U; Darwin Power Macintosh; en-US; rv:1.8.0.12) Gecko/20070803 Firefox/1.5.0.12 Fink Community Edition" , "gecko mac"], // firefox 1.5 darwin
3233
["Mozilla/5.0 (Windows; u; Windows NT 5.1; en-us; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1" , "gecko ff3 win"], // firefox 3 win
33-
["Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9a7) Gecko/2007080210 GranParadiso/3.0a7" , "gecko win"], // firefox dev
34+
["Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9a7) Gecko/2007080210 GranParadiso/3.0a7" , "gecko win vista"], // firefox dev
3435
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007120505 Minefield/3.0b2pre" , "gecko win"], // firefox dev
35-
["Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11" , "gecko ff2 win"], // firefox 2 vista
36+
["Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11" , "gecko ff2 win vista"], // firefox 2 vista
3637
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.13) Gecko/20060410 Firefox/1.0.8" , "gecko win"], // firefox 1 xp
3738
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20041002 Firefox/0.10.1" , "gecko win"], // firefox pre v1
3839
["Mozilla/5.0 (X11; U; SunOS sun4m; en-US; rv:1.4b) Gecko/20030517 Mozilla Firebird/0.6" , "gecko linux"], // firefox firebird
@@ -74,8 +75,8 @@
7475
// Opera
7576
["opera/9.80 (x11; linux i686; u; en) presto/2.2.15 version/10.01" , "opera opera10 linux"], // Opera 10.01
7677
["Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.2.15 Version/10.10" , "opera opera10 linux"], // Opera 10.10
77-
["opera/9.80 (windows nt 6.0; u; en) presto/2.2.15 version/10.00" , "opera opera10 win"], // Opera 10
78-
["opera/9.50 (j2me/midp; opera mini/ 4.1.11320/546; u; pt)" , "opera opera9 mobile"], // Opera Mini 10.00 on MAC with OS X
78+
["opera/9.80 (windows nt 6.0; u; en) presto/2.2.15 version/10.00" , "opera opera10 win vista"], // Opera 10
79+
["opera/9.50 (j2me/midp; opera mini/ 4.1.11320/546; u; pt)" , "opera opera9 mobile j2me"], // Opera Mini 10.00 on MAC with OS X
7980
["Opera/10.00 (Macintosh; Intel Mac OS X; u; en) presto/2.2.0" , "opera opera10 mac"], // Opera 10.00 on MAC with OS X
8081
["Opera/9.20 (Macintosh; Intel Mac OS X; U; en)" , "opera opera9 mac"], // Opera 9.20 on MAC with OS X
8182
["Opera/9.02 (Windows NT 5.0; U; en)" , "opera opera9 win"], // Opera 9.02 on Win 2K
@@ -133,14 +134,10 @@
133134
["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; Tablet PC 2.0; .NET CLR 4.0.20506; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)" , "ie ie8 win"],
134135
["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 3.0.04506; Media Center PC 5.0; SLCC1; Tablet PC 2.0)" , "ie ie8 win"],
135136
["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; InfoPath.2)" , "ie ie8 win"],
136-
137-
138-
139-
140-
["mozilla/4.0 (compatible; msie 8.0; windows nt 6.0; trident/4.0; slcc1; .net clr 2.0.50727; wwtclient2; infopath.2; officeliveconnector.1.3; officelivepatch.0.0; .net clr 3.0.30618; .net clr 3.5.30729)", "ie ie8 win"],
141-
["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)" , "ie ie8 win"],
142-
["Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0" , "ie ie7 win"],
143-
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET CLR 1.1.4322; Windows-Media-Player/10.00.00.3990; InfoPath.2" , "ie ie7 win"], // MSIE 7 running on Windows Vista 64-bit with a ton of 'stuff'
137+
["mozilla/4.0 (compatible; msie 8.0; windows nt 6.0; trident/4.0; slcc1; .net clr 2.0.50727; wwtclient2; infopath.2; officeliveconnector.1.3; officelivepatch.0.0; .net clr 3.0.30618; .net clr 3.5.30729)", "ie ie8 win vista"],
138+
["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)" , "ie ie8 win vista"],
139+
["Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0" , "ie ie7 win vista"],
140+
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET CLR 1.1.4322; Windows-Media-Player/10.00.00.3990; InfoPath.2" , "ie ie7 win vista"], // MSIE 7 running on Windows Vista 64-bit with a ton of 'stuff'
144141
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; Dealio Deskball 3.0)" , "ie ie7 win"], // MSIE 7 on XP and every version of .NET known to mankind
145142
["Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NeosBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" , "ie ie6 win"], // Explanation: MSIE 6.x on XP with a skin from neos.tv who seem to specialize in the hospitality (read hotel) industry.
146143
["Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" , "ie ie5 win"], // MSIE 5.5 on Windows 98
@@ -150,10 +147,11 @@
150147
["Mozilla/2.0 (compatible; MSIE 3.02; Windows CE; 240x320)" , "ie ie3 win"], // MSIE 3.02 on a Pocket PC 2002
151148
["Mozilla/1.22 (compatible; MSIE 2.0; Windows 95)" , "ie ie2 win"], // MSIE 2.0 in windows '95
152149
// Safari
153-
["mozilla/5.0 (windows; u; windows nt 6.0; pt-br) applewebkit/528.16 (khtml, like gecko) version/4.0 safari/528.16" , "webkit safari safari4 win"],
150+
["mozilla/5.0 (windows; u; windows nt 6.0; pt-br) applewebkit/528.16 (khtml, like gecko) version/4.0 safari/528.16" , "webkit safari safari4 win vista"],
154151
["Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-gb) AppleWebKit/523.10.6 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6" , "webkit safari safari3 mac"], // Safari 3.0.4 on Mac OS 10.5.1 Intel
155-
["Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" , "webkit safari safari3 ipod"], // Safari 3.0 for the iPod touch
156-
["Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3" , "webkit safari safari3 iphone"], // Safari 3.0 for the iPhone
152+
["Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" , "webkit safari safari3 mobile ipod"], // Safari 3.0 for the iPod touch
153+
["Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3" , "webkit safari safari3 mobile iphone"], // Safari 3.0 for the iPhone
154+
["Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10", "webkit safari safari4 mobile ipad"], // Safari 4.0 for the iPad
157155
["Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/522.11.1 (KHTML, like Gecko) Version/3.0.3 Safari/522.12.1" , "webkit safari safari3 mac"], // Safari 3.0.3 for Intel version of iMac
158156
["Mozilla/5.0 (Windows; U; Windows NT 5.1; bg) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1" , "webkit safari safari3 win"], // Safari 3.0.2 beta for Windows XP
159157
["Mozilla/5.0 (Windows; U; Windows NT 5.1; ru) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3" , "webkit safari safari3 win"], // Safari browser V 3.0 Beta for Windows XP SP2
@@ -171,6 +169,8 @@
171169
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51" , "webkit safari mac"], // Safari browser for MAC OS X
172170
// WebTV
173171
["Mozilla/4.0 WebTV/2.8 (compatible; MSIE 4.0)" , "gecko webtv"], // WebTV 2.8
172+
// Blackberry
173+
["blackberry9550/5.0.0.713 profile/midp-2.1 configuration/cldc-1.1 vendorid/105", "mobile blackberry "],
174174
]
175175

176176
document.writeln('<h1>Current Browser</h1>');
@@ -183,7 +183,10 @@
183183
$.each(user_agent_strings,function(index, item) {
184184
ua = item[0];
185185
codes_expected = item[1];
186-
codes_returned = css_browser_selector(ua).replace(' js','');
186+
debug = item[2];
187+
codes_returned = css_browser_selector(ua)
188+
if(debug) alert("|"+codes_returned+"|")
189+
codes_returned = codes_returned.replace(' js','');
187190
if(codes_expected == codes_returned) {
188191
output += '<p style="color: green">'+ua+' - '+codes_returned+'</p>';
189192
passed++;

0 commit comments

Comments
 (0)