mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-15 14:42:16 +03:00
Improve OS detection: iOS 26
This commit is contained in:
@@ -1253,8 +1253,19 @@
|
|||||||
if (this.itemType != UA_RESULT) {
|
if (this.itemType != UA_RESULT) {
|
||||||
rgxMapper.call(this.data, this.ua, this.rgxMap);
|
rgxMapper.call(this.data, this.ua, this.rgxMap);
|
||||||
}
|
}
|
||||||
if (this.itemType == UA_BROWSER) {
|
switch (this.itemType) {
|
||||||
|
case UA_BROWSER:
|
||||||
this.set(MAJOR, majorize(this.get(VERSION)));
|
this.set(MAJOR, majorize(this.get(VERSION)));
|
||||||
|
break;
|
||||||
|
case UA_OS:
|
||||||
|
if (this.get(NAME) == 'iOS' && this.get(VERSION) == '18.6') {
|
||||||
|
// Based on the assumption that iOS version is tightly coupled with Safari version
|
||||||
|
var realVersion = /\) Version\/([\d\.]+)/.exec(this.ua); // Get Safari version
|
||||||
|
if (realVersion && parseInt(realVersion[1].substring(0,2), 10) >= 26) {
|
||||||
|
this.set(VERSION, realVersion[1]); // Set as iOS version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,22 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"desc" : "iOS 18.6",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "iOS",
|
||||||
|
"version" : "18.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "iOS 26",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "iOS",
|
||||||
|
"version" : "26.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "iOS in App",
|
"desc" : "iOS in App",
|
||||||
"ua" : "AppName/version CFNetwork/version Darwin/version",
|
"ua" : "AppName/version CFNetwork/version Darwin/version",
|
||||||
|
|||||||
Reference in New Issue
Block a user