detect iphone, ipad or ipod via js

/ Published in: JavaScript

Was using this to disable certain js functionality as it wasnt working on apple\'s webkit

Copy this code and paste it in your HTML
  1. function appleMobileChk(){
  2. if (/iPhone/.test(navigator.userAgent) || /iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent)){
  3. return true;
  4. }
  5. else{
  6. return false;
  7. }
  8. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.