detect mobile safari browser - Javascript Browser Object Model

Javascript examples for Browser Object Model:Navigator

Description

detect mobile safari browser

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  www. j  a  v a2 s. c  om*/
     var ua = navigator.userAgent;
     if (ua.match(/(iPod|iPhone|iPad)/) !== null && ua.match(/AppleWebKit/) !== null && ua.search('CriOS') < 0) {
         console.log("You are using Mobile Safari!");
     } else {
         console.log("Whatever this is, it's not Mobile Safari...");
     }
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials