Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
FxOS: function(){
return navigator.userAgent.match(/mobi/i)
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
SymbianOS: function() {
return navigator.userAgent.match(/SymbianOS/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.FxOS() ||isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment