How to detect mobile safari browser in ios 7?

流过昼夜 提交于 2020-01-02 00:54:12

问题


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

For example:

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

回答1:


Try this (to detect iPod touch as well):

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



回答2:


Try this

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



回答3:


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

Gives simple T/F.



来源:https://stackoverflow.com/questions/18944110/how-to-detect-mobile-safari-browser-in-ios-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!