Skip to content

Instantly share code, notes, and snippets.

@davidthingsaker
Created December 11, 2013 16:25
Show Gist options
  • Save davidthingsaker/7913585 to your computer and use it in GitHub Desktop.
Save davidthingsaker/7913585 to your computer and use it in GitHub Desktop.
JavaScript and JQuery device detection
// JavaScript
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}
// JQuery
$.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment