Note that there are some explanatory texts on larger screens.

plurals
  1. POVersion Number of Smartphone OS's
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/4857195/how-to-programmatically-get-ioss-alphanumeric-version-string">How to programmatically get iOS’s alphanumeric version string</a> </p> </blockquote> <p>Is there any future proof regex to get the version number of the following smartphone OS's from the user-agent?</p> <p><strong>Android</strong></p> <p>(I have found something like: /Androids+([d.]+)/ )</p> <p><strong>iOS</strong></p> <p><strong>BlackBerry</strong></p> <p>Any advise would be much appreciated.</p> <p>Clarification: Seems like the question is asking how to get the mobile device OS version in a web-app, probably using JS.</p> <p>UPDATE:</p> <p>After I got quite bashed to ask this question I want at least provide the solution I came up with:</p> <pre><code>supportedDevice: function() { var supportedDevice = false; var userAgent = window.navigator.userAgent; // check for supported Android device if ( /Android/.test(userAgent) ) { var a_index = Number(userAgent.indexOf('Android')) + 8; var a_version = +userAgent.substring(a_index, a_index+1); if ( a_version &gt;= 3 ) { supportedDevice = true; console.log('Android device supported!') } } // check for iOS supported devices else if ( /iPhone/.test(userAgent) ) { var i_index = Number(userAgent.indexOf('iPhone OS')) + 10; var i_version = +userAgent.substring(i_index, i_index+1); if ( i_version &gt;= 6 ) { supportedDevice = true; console.log('iPhone device supported!') } } // check for iOS supported devices else if ( /BlackBerry/.test(userAgent) ) { var b_index = Number(userAgent.indexOf('Version/')) + 8; var b_version = +userAgent.substring(b_index, b_index+1); if ( b_version &gt;= 6 ) { supportedDevice = true; console.log('BB device supported!') } } return supportedDevice; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload