if (window.navigator.userAgent.indexOf('compatible') != -1) {
alert('360兼容模式');
}
if(window.navigator.userAgent.indexOf('AppleWebKit') != -1) {
alert('360极速模式');
}
以下源代码:
<html>
<head>
<title>JS显示当前浏览器详细信息</title>
<SCRIPT>
function whatBrowser()
{
document.Browser.Name.value=navigator.appName;
document.Browser.Version.value=navigator.appVersion;
document.Browser.Code.value=navigator.appCodeName;
document.Browser.Agent.value=navigator.userAgent;
if (window.navigator.userAgent.indexOf('compatible') != -1) {
alert('360兼容模式');
}
if(window.navigator.userAgent.indexOf('AppleWebKit') != -1) {
alert('360极速模式');
}
}
</SCRIPT>
<TABLE BORDER>
</head>
<body bgcolor="#fef4d9" onLoad="whatBrowser()">
<FORM NAME="Browser">
<TR> <TD> 名称: </TD> <TD>
<INPUT TYPE="txt" NAME="Name" Size="150"></TD> </TR>
<TR> <TD> 版本: </TD> <TD> <INPUT TYPE="txt" NAME="Version" Size="150"></TD> </TR> <TR> <TD> 内核: </TD>
<TD> <INPUT TYPE="txt" NAME="Code" Size="150"></TD>
</TR> <TR> <TD> User-Agent: </TD>
<TD> <INPUT TYPE="txt" NAME="Agent" Size="150"></TD>
</TR>
</FORM>
</TABLE>
</body>
</html>