Closed GoogleCodeExporter closed 8 years ago
I wonder if there's any logic about the UA string we could use to detect it
though, since it says OS 3_2 it's kinda tough
Original comment by els...@gmail.com
on 1 Oct 2010 at 3:25
This actually happens with all early beta versions of iOS. I've added an
additional check based on AppleWebkit version in my own ua parser. The code is
in Javascript and not immediately usable in browserscope, but you'll probably
get the meaning:
-----------
detected.os = {
name: 'iOS',
version: 1.0 // If no version is detected, it's 1.0
};
if (match = /OS (.*) like Mac OS X/.exec(ua)) {
detected.os.version = parseInt(match[1].replace('_', ''), 10) / 100;
if (detected.os.version < 1) {
detected.os.version *= 10;
}
}
/*
Sometimes Apple releases beta versions that still have the old version number,
but they do have an updated AppleWebKit version. Below are the first version of
iOS in which each version of AppleWebkit is shipped. If the reported version is
lower than the version expected from the AppleWebKit version, it is an early beta.
*/
var build = parseFloat(ua.match(/AppleWebKit\/([0-9.]*)/)[1]);
if (build >= 420.10) detected.os.version = Math.max(detected.os.version,
1.1) // 1.1
if (build >= 525.18) detected.os.version = Math.max(detected.os.version,
2.0) // 2.0
if (build >= 528.18) detected.os.version = Math.max(detected.os.version,
3.0) // 3.0 - 3.1
if (build >= 531.21) detected.os.version = Math.max(detected.os.version,
3.2) // 3.2
if (build >= 532.90) detected.os.version = Math.max(detected.os.version,
4.0) // 4.0 - 4.1
if (build >= 533.17) detected.os.version = Math.max(detected.os.version,
4.2) // 4.2 - 4.3
if (build >= 534.32) detected.os.version = Math.max(detected.os.version,
5.0) // 5.0
Original comment by niels.le...@gmail.com
on 24 Aug 2011 at 8:28
Original comment by els...@gmail.com
on 20 Jun 2012 at 4:25
Original issue reported on code.google.com by
cyb...@gmail.com
on 16 Sep 2010 at 10:36