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