如何在ios 7中检测移动safari浏览器?

时间:2022-09-15 10:36:08

What is the official method to detect mobile safari on ios7?

在ios7上检测移动游猎的官方方法是什么?

For example:

 navigator.userAgent.match(/(iPod|iPhone|iPad)/) 
 && navigator.userAgent.match(/AppleWebKit/) 
 && navigator.userAgent.match(/OS 7/)

3 个解决方案

#1


23  

Try this (to detect iPod touch as well):

试试这个(也检测iPod touch):

navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i)

#2


4  

Try this

navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)

#3


0  

/iP(ad|hone|od)/.test(navigator.userAgent)

Gives simple T/F.

提供简单的T / F.

#1


23  

Try this (to detect iPod touch as well):

试试这个(也检测iPod touch):

navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i)

#2


4  

Try this

navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)

#3


0  

/iP(ad|hone|od)/.test(navigator.userAgent)

Gives simple T/F.

提供简单的T / F.