Skip to content

Instantly share code, notes, and snippets.

@lordhumunguz
Forked from chrisgoddard/detect-mobile.js
Created February 24, 2017 02:36
Show Gist options
  • Save lordhumunguz/16433b3df45da0af9f380d4a14b26a7b to your computer and use it in GitHub Desktop.
Save lordhumunguz/16433b3df45da0af9f380d4a14b26a7b to your computer and use it in GitHub Desktop.
/**
* Simple regex/user agent mobile checker
* about 99% accurate when compared to 175k sessions in GA
*/
function isMobile()
{
return window.navigator.match(/Mobi|Touch|Opera\ Mini|Android/)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment