Jump to content

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

Have you looked into WURFL?

 

WURFL, the Wireless Universal Resource FiLe, is a Device Description Repository (DDR), i.e. a software component that maps HTTP Request headers to the profile of the HTTP client (Desktop, Mobile Device, Tablet, etc.) that issued the request.
Link to comment
https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353742
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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.