Mobile Browser Check
from detectmobilebrowsers.com
by Chris Vitalos
HTML
<p id='result'>init</p>
<p id='user-agent'>init</p>
JavaScript
document.getElementById('user-agent').innerHTML="User-agent header sent: " + navigator.userAgent;
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
document.getElementById('result').innerHTML="This is a mobile browser";
}
else {
document.getElementById('result').innerHTML="This is a desktop browser";
}