Jump to content

IOS version ?


Dicko_md

Recommended Posts

Hi

 

I would like to know if I can show the actual version of ios on an iphone, ipod or ipad etc on a webpage. ?

 

I have a script that says if the actual iphone is on ios 5 and if not to show another message but I just wondered if there is a script to show iphone is running IOS 5.1.1 ?

 

<script type="text/javascript">

    if (navigator.userAgent.match(/OS 5(_\d)+ like Mac OS X/i))

        // this helps detect minor versions such as 5_0_1

        document.write("You have iOS 5! Aren't you special!");

</script>

 

<script type="text/javascript">

if (navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 5_\d/i))

{

  alert("On iOS 5")

}

else

{

  alert("On iOS 4");

}

</script>

 

Thanks in Advance

Link to comment
https://forums.phpfreaks.com/topic/264000-ios-version/
Share on other sites

Is there a specific reason you want to look for 5.1.1, functionality wise? Unless this is for some cool magic trick to tell the user what they already know (, or stats, though I don't know why you would be doing anything related to that client-side,) you'd be much better off using "feature detection" techniques, as opposed to parsing the user agent. What I mean by that is don't check what device they're on, check if a certain function/object/property/feature exists.

Link to comment
https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353741
Share on other sites

Hi

 

I have a iPhone repair website and would just like to tell the user what ios version they are on and what the latest version is.

 

Saying wheather it's an iPod, iPhone or iPad would be great too.

 

I am open to other ways of getting the info if it's easier

 

Thanks again

 

Martyn

Link to comment
https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353748
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.