For a Chrome Desktop Extension home page, I\'m trying to detect whether a user is using Chrome for Desktop or Chrome for Mobile on Android. Currently the script below ident
The problem is the user agent will always have "Chrome" whether it is the desktop or mobile version. So you have to check the more specific case first.
$(document).ready(function(){
var ua = navigator.userAgent;
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(ua))
$('a.mobile-other').show();
else if(/Chrome/i.test(ua))
$('a.chrome').show();
else
$('a.desktop-other').show();
});