13

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/)
George Filippakos
  • 15,641
  • 13
  • 77
  • 89

3 Answers3

22

Try this (to detect iPod touch as well):

navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i)
Ehsan Tavakoli
  • 434
  • 1
  • 3
  • 10
4

Try this

navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)
Tepken Vannkorn
  • 9,550
  • 14
  • 58
  • 85
Barry
  • 421
  • 4
  • 4
0
/iP(ad|hone|od)/.test(navigator.userAgent)

Gives simple T/F.

user1212212
  • 1,213
  • 10
  • 5