user agent checking for ios6

Posted by Akash Saikia on Stack Overflow See other posts from Stack Overflow or by Akash Saikia
Published on 2012-07-03T12:06:00Z Indexed on 2012/10/05 3:38 UTC
Read the original article Hit count: 294

Filed under:
|
|

I am trying to check whether client opening the page is using iOS6 or not.

var startIndex = navigator.userAgent.search(/OS/i) + 2;
    var endIndex = navigator.userAgent.search(/like/i);
    var iOSVersion = parseInt(navigator.userAgent.substr(startIndex,endIndex - startIndex).trim());
    this.iOSVersion = true;

    if(!isNaN(iOSVersion)){
        this.iOSVersion = iOSVersion;
    }
    else if(Ext.is.Desktop){
        this.iOSVersion = true;
    }

The above code works well for all the versions of browsers.

But incase of using it in iOS6, it shows as iOS5. Searched for the same thing, but I didn't find a solution. May be I am still not done with searching for this, doing side by side search and hoping if some one has faced this issue before.

Any suggestions or updations?

© Stack Overflow or respective owner

Related posts about browser

Related posts about ios6