隐藏ie6用户的CSS和HTML?

时间:2013-02-15 16:01:08

标签: javascript jquery html css internet-explorer

我正在尝试强制我的ie6用户在查看我的网站时升级到现代浏览器。因为修改一切为ie6工作太费时间了。由于一切看起来都很糟糕,我宁愿隐藏整个CSS + HTML,只显示一个弹出式浏览器。我的问题是,如果用户使用ie6,如何设置所有元素不显示?

由于

2 个答案:

答案 0 :(得分:5)

<!--[if IE 6]>
    Special instructions for IE 6 here
<![endif]-->

示例:

<!--[if IE 6]>
    <style type="text/css">
         #browserWarning { display:block; }
         /* hide content here */
     </style>
<![endif]-->

http://www.quirksmode.org/css/condcom.html

答案 1 :(得分:0)

您可以在head元素的页面顶部添加此内容,以将用户重定向到特定页面。

if (navigator.userAgent.match(/MSIE/i)) {
    document.location.replace("/ie6warning.html");
}