Search code examples
htmliosios5responsive-designmedia-queries

Targeting users with ios 5 on the web


I'm coding a web app that uses a picture that the user can upload from their phones/computers and I found out that ios 5 doesn't allow you to upload anything (see A html5 web app for mobile safari to upload images from the Photos.app?).

Since it seems pretty much impossible I want to show a message to those users asking them to upgrade or pointing them to alternative solutions described in the link above (piccup and the like) if they want to use my app.

Can I direct this message just to ios 5 users via a media query or something similar?


Solution

  • Are you looking for a server side solution (Like PHP for example) or client side (JavaScript)?:

    Here is a JavaScript solution:

    <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>
    

    Source: https://stackoverflow.com/a/13087526/1800369

    For PHP you can track this: Detect iOS version with PHP