我有这个代码:
<body onload="detect(navigator.appName)">
<h2 id=alert>This tutorial is for Google Chrome users,
why would you want to read it?</h2>
</body>
<script>
function detect(x){
alert(x)
if (x != "Chrome"){
document.getElementById("alert").style.display = '';
}
}
</script>
问题是,每当我使用Google Chrome打开页面时,它都会返回“ Netscape ”。有解决方法吗?