Sunday, July 21, 2013

Detect Mobile Browers with JavaScript

Quick script to detect mobile browsers thanks to here:

//while I only have Adnroid OS's at this point, including others in case.
var mobile = (/silk|iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if ( mobile) {
window.open('mobileURL');
}else{
window.open('otherURL');
}
view raw detectMobile.js hosted with ❤ by GitHub

No comments: