Skip to content

Instantly share code, notes, and snippets.

@codeZoner
Created June 7, 2017 20:45
Show Gist options
  • Save codeZoner/ee2cab4fb0e28a9673bf15a77187c0dc to your computer and use it in GitHub Desktop.
Save codeZoner/ee2cab4fb0e28a9673bf15a77187c0dc to your computer and use it in GitHub Desktop.
Check If Mobile User Agent - Jquery
//https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device-in-jquery#answer-3540295
function isMobileUserAgent(){
var isMobile = false; //initiate as false
// device detection
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
isMobile = true;
}
return isMobile;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment