asimryu

mobile detection

Jul 16th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.48 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=2.0">
  6. <title>mobile</title>
  7. </head>
  8. <body>
  9. <script>
  10.     var ua = navigator.userAgent;
  11.     document.write(ua);
  12.     var ismobile = ua.match(/Mobile/i);
  13.     if( ismobile == "Mobile") {
  14.         document.write("<h1>모바일입니다.</h1>");
  15.     } else {
  16.         document.write("<h1>모바일이 아닙니다.</h1>");     
  17.     }
  18. </script>
  19. </body>
  20. </html>
Advertisement
Add Comment
Please, Sign In to add comment