您的位置:首页 > Web前端 > JavaScript

检测浏览器的js

2008-07-22 10:57 274 查看
CheckBrowser.js
--------------------------------------------------------------------
<!--
if (window.navigator.userAgent.indexOf("MSIE")>=1)
{
//ΪIE
//setActiveStyleSheet("default.css");
}
else
{
if (window.navigator.userAgent.indexOf("Firefox")>=1)
{
//ΪFirefox
//alert("ʹõΪFirefox ڼ⣬ʹIE");
alert("The browser you use is Firefox. Because of compatibility, please use IE.");
location.href="javascript:window.close()";
}
else
{
//Ϊ
//alert("ʹõIE ڼ⣬ʹIE");
alert("The browser you use is not IE. Because of compatibility, please use IE.");
location.href="javascript:window.close()";
}
}
//-->
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: