You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that there is a bug in UserAgent parsing when it is run on "old" Safari Browser.
Ex : Mozilla/5.0 (iPhone; CPU iPhone OS 9_0_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13A405 Safari/601.1
Result is : BrowserInfo {name: "ios", version: "9...0", os: "iOS", type: "browser"}
However, "9...0" is not semver compliant.
This is due to the fact that Safari 9 do not manage String.split(regexp) very well. (See http://blog.stevenlevithan.com/archives/cross-browser-split)
For example : console.log('9.0'.split(/[._]/))
Will give : [0: "9", 1: ".", 2: "0"]
Suggestion, replace (See https://www.xspdf.com/resolution/52116414.html) : let versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);
With : let versionParts = match[1] && match[1].split('.').join('_').split('_').slice(0, 3);
Yours faithfully,
LCDP
The text was updated successfully, but these errors were encountered:
Hi,
It seems that there is a bug in UserAgent parsing when it is run on "old" Safari Browser.
Ex :
Mozilla/5.0 (iPhone; CPU iPhone OS 9_0_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13A405 Safari/601.1
Result is :
BrowserInfo {name: "ios", version: "9...0", os: "iOS", type: "browser"}
However, "9...0" is not semver compliant.
This is due to the fact that Safari 9 do not manage String.split(regexp) very well. (See http://blog.stevenlevithan.com/archives/cross-browser-split)
For example :
console.log('9.0'.split(/[._]/))
Will give :
[0: "9", 1: ".", 2: "0"]
Suggestion, replace (See https://www.xspdf.com/resolution/52116414.html) :
let versionParts = match[1] && match[1].split(/[._]/).slice(0, 3);
With :
let versionParts = match[1] && match[1].split('.').join('_').split('_').slice(0, 3);
Yours faithfully,
LCDP
The text was updated successfully, but these errors were encountered: