Dicko_md Posted June 11, 2012 Share Posted June 11, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/264000-ios-version/ Share on other sites More sharing options...
Adam Posted June 14, 2012 Share Posted June 14, 2012 The user agent exposes the version as say "5_1_1". How exactly do you want to fit this into your current script? Only detect 5.1.1, or detect 5 then 5.1.1? Quote Link to comment https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353714 Share on other sites More sharing options...
Dicko_md Posted June 14, 2012 Author Share Posted June 14, 2012 Hi I'd love the webpage to say if an iPhone went on the webpage for it to say Your iPhone ios is 5.1.1 Or Your iPad iOS is on 5.1.1 I can sort the windows version etc but struggling with ios Thanks in advance Martyn Quote Link to comment https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353734 Share on other sites More sharing options...
Adam Posted June 14, 2012 Share Posted June 14, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353741 Share on other sites More sharing options...
Mahngiel Posted June 14, 2012 Share Posted June 14, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353742 Share on other sites More sharing options...
Dicko_md Posted June 14, 2012 Author Share Posted June 14, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/264000-ios-version/#findComment-1353748 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.