Detect Mobile Safari
Many scripts on the web detect only Safari, or only Apple devices, but return false positives like desktop Safari or Mobile Chrome. Here's my take to detect only Mobile Safari - Save for the next time it drives you crazy with creative & annoying bugs:
/iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i
As a Modernizr test:
Modernizr.addTest('mobilesafari', function() {
return /iP(ad|hone|od).+Version\/[\d\.]+.*Safari/i.test(navigator.userAgent);
});
Source for Safari-only part: urbz on StackOverflow
Written by Ronny Orbach
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mobile
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#