Skip to content

Commit

Permalink
fix: safari regexp should handle ipads useragents (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen authored Oct 18, 2022
1 parent c6d833f commit c889abf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ export const regexes = [
Infinity
]
},
/**
* Safari on iPad have desktop-like useragent
*/
{
regex: /Version\/(\d+)\.(\d+)([.,](\d+)|) Safari\//,
regex: /Maci.* Version\/(\d+)\.(\d+)([.,](\d+)|)( Mobile\/\w+|) Safari\//,
family: 'safari'
},
/**
Expand Down
5 changes: 5 additions & 0 deletions test/useragents.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ export const useragents = [
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',
regex: ['safari']
},
{
// iPad 7th Gen have "Mobile/"
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',
regex: ['safari']
},
/**
* Opera Desktop on Presto
*/
Expand Down

0 comments on commit c889abf

Please sign in to comment.