Detect ALL mobile devices with JavaScript


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var isMobileDevice = function () {
  2. return !!(navigator.userAgent.toLowerCase().match(/(iPhone|iPod|blackberry|android 0.5|htc|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone|Windows Mobile|IEMobile|Windows CE|Nintendo Wii)/i));
  3. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.