Skip to content

Commit 5a59c50

Browse files
committed
Merge pull request #830 from miketaylr/no-android-version
Fixes #647: Update android regex to match Firefox for Android.
2 parents eb35bc5 + d21ce64 commit 5a59c50

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/detect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
function detect(ua){
77
var os = this.os = {}, browser = this.browser = {},
88
webkit = ua.match(/WebKit\/([\d.]+)/),
9-
android = ua.match(/(Android)\s+([\d.]+)/),
9+
android = ua.match(/(Android);?\s+([\d.]+)?/),
1010
ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
1111
ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/),
1212
iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),

test/detect.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,15 @@ <h1>Browser detection</h1>
337337
detect(UA.Firefox_13_Tablet, function(os, browser){
338338
t.assertTrue(browser.firefox)
339339
t.assertFalse(browser.webkit)
340+
t.assertTrue(os.android)
340341
t.assertFalse(os.phone)
341342
t.assertTrue(os.tablet)
342343
})
343344

344345
detect(UA.Firefox_13_Phone, function(os, browser){
345346
t.assertTrue(browser.firefox)
346347
t.assertFalse(browser.webkit)
348+
t.assertTrue(os.android)
347349
t.assertTrue(os.phone)
348350
t.assertFalse(os.tablet)
349351
})

0 commit comments

Comments
 (0)