Posted By

cerxx on 04/01/19


adaptive check-device

Versions (?)

How to detect a mobile device using javascript?

 / Published in: JavaScript


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.