如何 - 如果使用IE8不加载Web内容

时间:2013-08-07 15:45:06

标签: html internet-explorer

我有一个网站,只是IE8的功能。 我目前有一个网站显示一个横幅,让访问者升级IE。我想做更多......

我想做的是,除了显示“抱歉您的浏览器不符合查看此网站的要求”之类的消息外,还要显示该横幅。 我不希望它加载任何其他页面内容。

有没有办法说不在IE if语句中加载页面的其余部分?

<!--[if lt IE 8]>
    <div style=' clear: both; text-align:center; position: relative;'>
        <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a>
    </div>

    -- Here is where I want to say DON'T LOAD ANYTHING ELSE.
    -- Maybe automatically redirect to another blank page?

<![endif]-->

4 个答案:

答案 0 :(得分:2)

此类文件的基本结构:

<body>
<!--[if lte IE 8]
    <div style=' clear: both; text-align:center; position: relative;'>
        <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a>
    </div>
<![endif]-->
<!--[if gt IE 8] -->
    The rest of the document goes here. 
    All browsers except IE 8 and below parse this.

    ..content...

    Rigth at the end close the conditional.
<!-- <![endif]-->
</body>
</html>

请注意,排除版本8应为lte IE 8

答案 1 :(得分:1)

如果真的需要这样做,请在head

<!--[if lt IE 8]>
    <meta  http-equiv="refresh" content="0;url=i_should_fix_this_for_ie8.html">
<![endif]-->

答案 2 :(得分:1)

<!--[if lte IE 8]>
    <div style=' clear: both; text-align:center; position: relative;'>
        <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a>
    </div>
<![endif]-->

<!--[if gt IE 9]-->
    Here's where IE 9+ content goes (as well as content for any other browser).
<!--[endif]-->
根据Juhana的建议

编辑

答案 3 :(得分:0)

你真的可以用javascript来隐藏页面,例如隐藏内容,或者在上面放置div,但最好的办法就是让用户查看页面而不管它是多么混乱。许多人经常使用旧的Web浏览器,尤其是在企业网络上。因此,如果您这样做,那些人可能根本无法查看您的页面。