How do detect Android Tablets in general. Useragent? – Stack Overflow

How do detect Android Tablets in general. Useragent? – Stack Overflow.

 

Here’s a quick JS that should work (NOT TESTED!!)

function detectMobile(){

if( (navigator.userAgent.match(/iPhone/i)) ||

(navigator.userAgent.match(/iPod/i)) ||

(navigator.userAgent.match(/iPad/i)) ||

(navigator.userAgent.match(/Android/i)) ||

(navigator.userAgent.match(/android/i)) ||

(navigator.userAgent.match(/webOS/i)) ||

(navigator.userAgent.match(/BlackBerry/i)) ||

(navigator.userAgent.match(/Opera Mobi/i)) ||

(navigator.userAgent.match(/MOT/i))

) {

if ( (navigator.userAgent.match(/android/i)) && (navigator.userAgent.match(/Mobile/i)) ) {

//android mobile phone

} else {

//android tablet

}

 

window.location = “mobile/index.aspx”;

}

}

detectMobile();