如何强制IE *不*使用兼容模式? [英] How can I force IE to *not* use compatibility mode?

查看:192
本文介绍了如何强制IE *不*使用兼容模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经仔细查看了stackoverflow,发现以下是强制不兼容模式的最佳推荐方法:

I have looked through stackoverflow quite a bit and found that the following is the most recommended way to force non-compatibility mode:

<meta http-equiv="X-UA-Compatible" content="IE=edge" >

我对这些答案的问题是它们都是IE 8& 9时代的答案。

My issue with these answers is that they are all IE 8 & 9 era answers.

这种仍然是强制使用用户正在运行的最新浏览器的方式吗?

Is this still the way to force to the latest browser that the user is running?

这是针对公共网站的,我们的用户经常使用IE10,IE9,IE7& IE8(大致按此顺序)。

是的,IE7的使用比IE8更常见。

This is for a public site and our users often use IE10, IE9, IE7 & IE8 (roughly in that order).
And yes, IE7 use is more common than IE8.

我对IE8的唯一限制就是网站可读。

My only constraint for IE8 is that the site be readable.

这是一个现代化的网站,我希望用户不能在兼容模式下使用任何浏览器。我知道有一种方法可以指定浏览器版本,但我不想在下个月底使用Win10。

It is a modern site, and I want whatever browser the user has to not be in compatibility mode. I know there is a way to specify a browser version, but I'd prefer not to do that with Win10 coming at the end of next month.

如果有人有任何关于Windows 10将使用哪一行知道(新浏览器称为Edge)的信息。

If anyone has any info on what Windows 10 will do with this line that would be very useful to know (the new browser is called "Edge").

感谢您提供的任何帮助提供。

Thanks for any help that can be provided.

-Chris C。

PS
我的页面的第一行(没有空格)我有以下内容:

P.S. I do have the following as the first line (no spaces) of the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"

http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1。 dtd >

推荐答案

我在Internet Explorer和Microsoft Edge团队工作。

I work on the Internet Explorer and Microsoft Edge team.

您提供的是 x-ua-compat 标头/元标记。它被设计为一种保留式解决方案,可帮助您继续前进并采用对现代浏览器的支持,而无需立即负责现代化您的代码库。它不是网络兼容性的长期解决方案。

What you provided is the x-ua-compat header/meta-tag. It is designed as a hold-over solution to help you move forward and adopt support for modern browsers, without having to immediately take care of modernizing your codebase. It is not meant as a long-term solution for web compatibility.

为用户提供最理想体验的最佳方式是首先使用HTML5 doctype:

The best way to give your user the most ideal experience is to first use the HTML5 doctype:

<!DOCTYPE html>

这应该是你文件中的第一件事;什么都不应该在它之前。从那时起,单独使用有效标记。检查您的文档是否有错误,不平衡标签,还原标签等。请记住,定期验证您的标记

That should be the first thing in your document; nothing should preceed it. From then on, use valid markup alone. Check your document for errors, unbalanced tags, redudant tags, etc. Remember, valid your markup regularly.

仅使用 x-ua如果您拥有无法立即替换/删除的旧代码,请使用-compat 标头/元标记。在这些情况下,允许您的用户处于遗留文档模式:

Only use the x-ua-compat header/meta-tag when you have legacy code that you cannot immediately replace/remove. In these scenarios, it is permissible to put your users in a legacy document mode:

<meta http-equiv="X-UA-Compatible" content="IE=9" />

如果该模式存在,以上将使浏览器进入Internet Explorer 9的边缘模式。在9之前的Internet Explorer版本中,将使用最新的文档模式。

The above will put the browser into Internet Explorer 9's Edge Mode, provided that mode exists. In versions of Internet Explorer prior to 9, the latest document mode will be used.

您还可以堆叠这些以显示优惠:

You can also stack these to show favor:

<meta http-equiv="X-UA-Compatible" content="IE=10,9,7,8" />

但请不要忘记我的主要信息 - 以上仅作为临时解决方案。最终目标是使用现代代码更新您的文档。

But please don't forget my primary message here - the above is meant only as a temporary solution. The ultimate goal is to get your document updated with modern code.

Microsoft Edge,Internet Explorer的继任者, 不支持文档模式 。 Microsoft Edge将解释您的文档,如Firefox和Chrome。

Microsoft Edge, Internet Explorer's successor, does not support document modes. Microsoft Edge will interpret your document like Firefox and Chrome do.

这篇关于如何强制IE *不*使用兼容模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆