How to force intranet sites browser into IE8 Quirks Mode?

强颜欢笑 提交于 2019-12-13 19:35:42

问题


I have an intranet site built using ASP.NET that when rendered always displays in standards mode. When using the Developer Toolbar, my site works perfectly using 'IE8 - Quirks Mode'. When using Standards mode it does not appear properly.

I have seen a dozen posts about setting the app into Standards mode (like this one: Override intranet compatibility mode IE8) but these techniques make the browser go to Standards mode.

Does that mean Quirks is the default? If that's the case, my site is not rendering by default in Quirks but rather in Standards.

I also tried this as well and it to makes it in Standards mode:
<meta http-equiv="X-UA-Compatible" content="IE=8" />

What meta tag can I assign or other technice to ensure my site is always rendered in IE 8 - Quirks Mode?


回答1:


content="IE=8" will make it use IE 8 Standards. To use quirks as far as I'm aware change the doctype as such:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">"

Or leave it out entirely




回答2:


Firstly, the best thing you can do is try to drop the requirement for Quirks mode. It doesn't just change the page layout, it also switches off all of the modern browser features.

This will give you problems if you want to use any of these modern features. (note that quirks mode is an IE5-compatibility mode, so "modern features" means pretty much anything invented since IE5!). For this reason, I strongly recommend if at all possible that you consider switching the site so it works in Standards mode.

The main reason for using standards mode is to future-proof your code. IE's bad reputation is due to old versions and features like quirks mode, and in recent versions of IE, Microsoft are trying to move away from the past. I would not be surprised to see quirks mode disappear from the browser at some point in the future.

In addition, using standards mode will allow your site to work properly in all other browsers. In Quirks mode, your site will only ever work properly in IE.

The good news is that switching a site from quirks mode to standards mode is often a lot less work than it sounds. The main thing you need to know about is a CSS feature box-sixing. This allows you to use the quirks mode layout model while still keeping the site in standards mode.

Add the following to your CSS:

* {box-sizing:border-box;}

This shuold hopefully fix the majority of the layout issues that you're getting switching from quirks mode to standards mode, and should allow you to stay in standards mode.

The remainder of the layout issues are likely to be caused by bugs in IE5 that have been fixed in subsequent IE versions but left in quirks mode for compatibility reasons. You will probably need to fix these manually. But hopefully there won't be too many of them.



Okay, so if you're still reading, I'm going to assume that the above isn't good enough for you, and you really do want to stick to quirks mode.

Putting a site in quirks mode is fairly easy in IE: Just drop the DOCTYPE declaration.

When IE sees a site that doesn't have a doctype, it automatically assumes that it should render it in quirks mode.

As I say, I strongly recommend not doing this, but if you absolutely have to, that's how to do it.



来源:https://stackoverflow.com/questions/19007950/how-to-force-intranet-sites-browser-into-ie8-quirks-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!