Skip to content

Instantly share code, notes, and snippets.

@haoflynet
Created October 21, 2015 03:38
Show Gist options
  • Save haoflynet/42d7b4a26df03798cc7b to your computer and use it in GitHub Desktop.
Save haoflynet/42d7b4a26df03798cc7b to your computer and use it in GitHub Desktop.
Javascript
window.onload=function(){
var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");
var browser = navigator.userAgent.toLowerCase();
for (var i=0; i<mobileAgent.length; i++){
if (browser.indexOf(mobileAgent[i])!=-1){
alert(mobileAgent[i]);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment