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
  • 16,359
  • 15
  • 81
  • 92

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
  • 444
  • 1
  • 3
  • 10
4

Try this

navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)
Tepken Vannkorn
  • 9,648
  • 14
  • 61
  • 86
Designworxz
  • 535
  • 4
  • 6
0
/iP(ad|hone|od)/.test(navigator.userAgent)

Gives simple T/F.

user1212212
  • 1,311
  • 10
  • 6