Skip to content

Commit c889abf

Browse files
authored
fix: safari regexp should handle ipads useragents (#8)
1 parent c6d833f commit c889abf

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ export const regexes = [
7777
Infinity
7878
]
7979
},
80+
/**
81+
* Safari on iPad have desktop-like useragent
82+
*/
8083
{
81-
regex: /Version\/(\d+)\.(\d+)([.,](\d+)|) Safari\//,
84+
regex: /Maci.* Version\/(\d+)\.(\d+)([.,](\d+)|)( Mobile\/\w+|) Safari\//,
8285
family: 'safari'
8386
},
8487
/**

test/useragents.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ export const useragents = [
176176
ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Safari/605.1.15',
177177
regex: ['safari']
178178
},
179+
{
180+
// iPad 7th Gen have "Mobile/"
181+
ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Mobile/15E148 Safari/604.1',
182+
regex: ['safari']
183+
},
179184
/**
180185
* Opera Desktop on Presto
181186
*/

0 commit comments

Comments
 (0)