简体   繁体   English

我如何仅显示HTML

[英]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: 只需将iframe放在内容的末尾,即可显示实际的页面内容,如下所示:

<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. 只要iframe没有任何文本内容,即使在第一个Internet浏览器的第一个版本中,它也将不可见。 This is a more solid approach than only using conditional comments because they didn't exist until IE 5. 与仅使用条件注释相比,这是一种更可靠的方法,因为它们直到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). 然后,因为没有一个理智的人愿意投入足够的时间,精力和精力来为普通网站提供与IE5的兼容性,所以您可以使用下层显示的条件注释(感谢iframe的支持)。

Then, you can add in a little super-basic CSS for browsers like the oldest version of Netscape. 然后,您可以为浏览器(如最旧的Netscape版本)添加一些超基本CSS。 Super-basic CSS includes things like color and crop, and excludes things like just about everything cool and modern. 超基本CSS包括颜色和裁切之类的东西,并且不包括诸如酷炫和现代之类的东西。

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 . 可以在以下位置找到最完整的位: 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. 因此,该方法将允许您在IE 6之前的所有浏览器上显示该网页的替代形式。然后,您可能会问Chrome,Firefox,Opera和其他浏览器如何。 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. 而且,这对我来说已经足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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