简体   繁体   中英

How Do I Show HTML Only In <IE6 Old Browsers

因此,如果过去的某个时光旅行者使用Netscape或Internet Explorer的真正古老版本登录我的网站,那么我该如何仅为他们显示内容?

Simply, you put an iframe at the end of your content that displays your actual page contents like so:

<title>Your websites title</title>
<body style="margin:0px;font-size:0px;width:100%;height:100%;overflow:hidden">
    <h1>heading</h1>
    <p>Body paragraph</p>
    <!--[if gte IE 6]><!-->
    <iframe frameborder="0" width="100%" height="100%" src="main.html" style="position:relative;width:100%;height:100%;background-color:white"></iframe>
    <!--<![endif]-->
    <style language="css" type="text/css">/*<!--*/

    /*-->*/</style>
</body>

So long as the iframe doesn't have any text contents, it will be invisible in even the first version of the first internet browser. This is a more solid approach than only using conditional comments because they didn't exist until IE 5.

Then, because no sane person would want to put in enough time, energy, and effort to provide compatibility with IE5 for an ordinary website, you can just use down-level revealed conditional comments (supported before iframes were supported thankfully).

Then, you can add in a little super-basic CSS for browsers like the oldest version of Netscape. Super-basic CSS includes things like color and crop, and excludes things like just about everything cool and modern.

My source for this is, of course, the source code for the world's first website. The most complete bits can be found here: at cern . It is also the reason for putting the title outside of the head, and not including any head at all.

SO, this method will allow you to display a plain alternative to the webpage to all browsers older than IE 6. You may then ask what about Chrome, Firefox, Opera, and other browsers. Well, those browsers automatically update. So really, there is no real need to extend support to previous versions of them.

At any rate, the above layout is sketcky at best, but hey: it workz. And, that is good enough for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM