1

I need to check if an iOS device visiting my Website has iOS 3.0 or higher installed. Can I do that?

4 Answers 4

1

If you wish to check what browser/mobile device is accessing you site - then the answer is that you can use read the userAgent string and search for OS and the number. For example:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7

and another useful online tool to check your browser UA is: http://whatsmyuseragent.com/

Sign up to request clarification or add additional context in comments.

1 Comment

I would need something that works like this: ìf(iOS_Version >= 3.0) { redirect to other site } Is there a possibility to do that with userAgent???
1

Yes you can. Either PHP or Javascript will do the trick. iOS devices report their iOS version in their user-agent string. Here are the Apple docs: Using the Safari User Agent String. Some example user-agent strings might look like:

Mozilla/5.0 (iPhone; U; CPU iOS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/XXXXX Safari/525.20
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.05 Mobile/8A293 Safari/6531.22.7
Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X;  en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2  Mobile/8J2 Safari/6533.18.5

From there it's easy to see which version of iOS is being run.

2 Comments

I hope I do not sound stupid but how do I achieve this 3.0 or higher thing. Obviously I can check for specific iOS versions like 4_3_3 but I need to check for 3 or higher. Do I have to check for every single Version of iOS available?
@matteok Look at my answer below, it will answer it :)
0

Bit of an older question, but I believe none of the answers currently given answer the question appropriately.

If you want to do something like

if(iOS_version > 3){
    // Open something
}

Then I believe you are looking for

if(/(iPhone|iPad|iPod)\sOS\s3/.test(navigator.userAgent)) {
    // use apple maps
}

Where s3 is looking for iOS3. Change s3 to s9 to check for iOS9

Comments

0

You can use the user-agent which is send with the HTTP-request. This can then be processed by PHP.

See this tutorial (note that this targets the iPad. But the iPhone should have something similar).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.