我编写了一个JavaScript来检查我的应用程序执行的浏览器,但是当我在iPad上运行我的应用程序时,却找不到Chrome浏览器。谁可以帮我这个事?我正在尝试在iPad Chrome浏览器中运行我的应用程序:
<script type="text/javascript">
var browser;
var yourVersion;
var supportedVersion;
checkBrowser();
function checkBrowser() {
var chrome = navigator.userAgent.match("Chrome\/([0-9]{2,}\.[0-9]*)");
var ff = navigator.userAgent.match("Firefox\/([0-9]{2,}\.[0-9]*)");
var ie = navigator.userAgent.match("MSIE\ ([0-9]{2,}\.[0-9]*)");
if (chrome) {
browser = "Chrome";
yourVersion = chrome[1];
supportedVersion = 35;
if(chrome[1] < supportedVersion) {
$("#browserVersionWarning").show();
}
} else if(ff) {
browser = "Firefox";
yourVersion = ff[1];
supportedVersion = 31;
if (ff[1] < supportedVersion) {
$("#browserVersionWarning").show();
}
} else if(ie) {
browser = "IE";
yourVersion = ie[1];
supportedVersion = 11;
if (ie[1] < supportedVersion) {
$("#browserVersionWarning").show();
}
} else {
supportedVersion = 31;
$("#yours").html(" ");
$("#recommended").html("Firefox " + supportedVersion);
$("#browserVersionWarning").show();
return;
}
$("#yours").html(browser + " " + yourVersion);
$("#recommended").html(browser + " " + supportedVersion);
}
</script>