<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
<title>Browser Check</title>
</head>
<body>
<div id="result"></div>
<script type="text/javascript">
var explorer = window.navigator.userAgent ;
if (explorer.indexOf("MSIE") >= 0) {//ie10及以下
var b_name=navigator.appName;
var b_version=navigator.appVersion;
var version=b_version.split(";");
version=version[1].replace(/[ ]/g,"");
version=version.split('MSIE')[1];
browser='IE:'+version;
}else if (explorer.indexOf("Firefox") >= 0){//Firefox
browser='Firefox';
}else if (explorer.indexOf("Chrome") >= 0){//Chrome
browser='Chrome';
}else if (explorer.indexOf("Opera") >= 0){//Opera
browser='Opera';
}else if (explorer.indexOf("Safari") >= 0){//Safari
browser='Safari';
}else if (explorer.indexOf("Trident/7.0") >= 0){//IE11
browser='IE:10.0以上';
}
document.getElementById('result').innerHTML = browser;
</script>
</body>
</html>
版权声明:本文为博主原创文章,未经博主允许不得转载。