Skip to content

Commit a886604

Browse files
committed
Fix #605 - Identify Macintosh as Apple device
1 parent b814bcd commit a886604

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/ua-parser.js

+2
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@
390390
/applecoremedia\/[\w\.]+ \((ipad)/i,
391391
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i
392392
], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
393+
/(macintosh);/i
394+
], [MODEL, [VENDOR, APPLE]], [
393395

394396
// Huawei
395397
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i

test/device-test.json

+9
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,15 @@
754754
"type": "mobile"
755755
}
756756
},
757+
{
758+
"desc": "Apple Desktop",
759+
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15",
760+
"expect": {
761+
"vendor": "Apple",
762+
"model": "Macintosh",
763+
"type": "undefined"
764+
}
765+
},
757766
{
758767
"desc": "iPad using UCBrowser",
759768
"ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3",

0 commit comments

Comments
 (0)