html5页面资源预加载(Link prefetch)

---恢复内容开始---

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<base >

<title></title>

<script>
function bro(){
// var is360 = false;
//application/vnd.chromium.remoting-viewer 可能为360特有
var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
var isIE = false;
var isFirefox = false;
var isCrome = false;
var broName = '';
if(window.navigator.userAgent.indexOf('MSIE')!=-1&&window.navigator.appName.indexOf("Microsoft") != -1){
isIE = true;
broName = 'IE';
alert(ie)
}
if(window.navigator.userAgent.indexOf('Firefox')!=-1){
isFirefox = true;
broName = 'Firefox';
alert(firefox)
}
if(window.navigator.userAgent.indexOf('Chrome')!=-1){
// if(window.navigator.webkitPersistentStorage){
// isCrome = true;
// broName = 'Chrome';
// }else if(_mime()){
// is360 = true;
// broName = '360';
// }

if(is360){
// is360 = true;
broName = '360';
alert("360")
}else if(_mime() && !is360){
isCrome = true;
broName = 'Chrome';
alert("chrome");
}
}

document.getElementById('broType').value=broName;

}

//测试mime
function _mime(option, value) {
var mimeTypes = navigator.mimeTypes;
for (var mt in mimeTypes) {
if (mimeTypes[mt][option] == value) {
return true;
}
}
return false;
}
</script>
</head>

<body onload="bro();">
<input type="text" id="broType" name="broType">
</body>
</html>

---恢复内容结束---

posted @ 2018-07-27 11:04  yaomengli  阅读(1020)  评论(0编辑  收藏  举报