Loading JS script for only iOS devices?

后端 未结 3 794
野性不改
野性不改 2020-12-14 04:18

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

3条回答
  •  -上瘾入骨i
    2020-12-14 05:05

    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.

提交回复
热议问题