Last active
August 29, 2015 14:05
-
-
Save digdeep/c622c528b3d71843675e to your computer and use it in GitHub Desktop.
isMobileTabletDesktop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (navigator.userAgent.match(/Mobi/)) { | |
// mobile! | |
var windowWidth = window.screen.width < window.outerWidth ? | |
window.screen.width : window.outerWidth; | |
if(windowWidth < 683){ | |
deviceType = 'mobile'; | |
} else { | |
deviceType = 'tablet'; | |
} | |
} | |
else if( navigator.userAgent.match(/iPad|Nexus|Tablet/i) ){ | |
deviceType = 'tablet'; | |
} | |
else { | |
deviceType = 'desktop' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment