Skip to content Skip to sidebar Skip to footer

Loading Js Script For Only Ios Devices?

I have a jQuery script I'm using on a site to allow fixed position background images on iPhone/iPad/iPod. However it seems to be clashing with another script I am using on the site

Solution 1:

You can use the Mobile Safari user agent string to detect mobile safari server-side, see: How do I detect Mobile Safari server side using PHP?


You can also do this in JavaScript:

if(navigator.userAgent.match(/(iPhone|iPod|iPad)/i))

See iPhone & iPod Detection Using JavaScript for more information.

Solution 2:

You can use Detect Mobile Browser (it has a library for javascript).

Solution 3:

you can also try this

if (navigator.userAgent.match(/like Mac OS X/i)) {
                alert('Hi, you\'re browsing from an iOS device.');
}

Post a Comment for "Loading Js Script For Only Ios Devices?"