Posted By

cerxx on 04/01/19


Tagged

adaptive check-device


Versions (?)

How to detect a mobile device using javascript?


 / Published in: JavaScript
 

URL: http://qaru.site/questions/89891/how-to-detect-a-mobile-device-with-javascript#583197

If you want to determine if a user is in ANY form of a mobile device (Android, iOS, BlackBerry, Windows Phone, Kindle, etc.), you can use the following code:

  1. if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) {
  2. // Take the user to a different screen here.
  3. }

Report this snippet  

You need to login to post a comment.