使用 Internet Explorer 兼容模式的缺点
强制在 IE 中以兼容模式查看网站有什么缺点?假设我们强制 IE9 为 IE8兼容模式?
- 性能缺陷
- 无法使用任何新的 IE9 特定功能,例如 HTML5/CSS3/SVG
为什么?
我们运行自 2000 年以来开发的旧版 Web 应用程序,因此与 Chrome、Opera、Firefox、IE6/7/8 兼容是一场混乱的战斗,现在我们决定将 IE9 添加到列表中。但是使用 IE9,我们会遇到打印问题、“权限被拒绝”JavaScript 错误(可能与跨框架 JavaScript 调用有关)以及接下来的问题 - 简单的解决方法是强制 IE9 表现得像 IE8 一样,然后一切正常。但我仍然不确定这是否可行......
What are cons of force a web site viewed in IE to compatible mode? Say we force IE9 to IE8 compatiblity mode?
- Performance drawbacks
- Can't use any new IE9 specific features like HTML5/CSS3/SVG
Why?
We run legacy web app which is developed since 2000 so it's a mess ball fighting to be compatible with Chrome, Opera, Firefox, IE6/7/8 and now we decide to add IE9 to the list. But with IE9 we run in issues with printing, "Permission deniend" JavaScript errors (probably something about cross-frame JavaScript calls) and next issues - the easy workaround is to force IE9 to behave as a IE8 and then everything works fine. But I am still not sure if it's way to go...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您有一个 2000 年开发的公共网站,但它无法在现代浏览器上运行?弃用它或重写它。
不要破解您的代码来支持现代浏览器,该网站显然写得不好并且不符合标准。 您无法摆脱这一点。
唯一可以摆脱这种程度的不兼容性的地方是 Intranet 应用程序,即使这样,您也应该简单地声明“它可以在浏览器 X 上运行,实时” ”
你不能对面向公众的客户这么说。我的意思是你可以尝试,但以将业务输给竞争对手为乐。
重新开发您的网站以符合 W3C HTML/CSS 标准和 ES5 标准,它将完全面向未来(几年)。
唉,网络的工作方式是,任何超过 5 年的内容都将被弃用。因此,要么每 5 年重新编写一次,要么退出网络业务。
就实际使用兼容模式而言,不要。 IE6-8 是可怕的引擎,应该像瘟疫一样避免。如果您使用它们,那么您就无法编写面向未来的标准兼容代码。
您的代码需要符合标准,并且您应该修复/填充/修补任何浏览器特定的错误,其中这些浏览器不实现标准。
You have a public website developed in 2000 and it doesn't work on modern browsers? Deprecate it or re-write it.
Don't hack your code to support modern browsers, the website is clearly poorly written and doesn't apply to standards. You can't get away with this.
The only place where you can get away with this level of incompatibility is intranet applications and even then you should simply state "it works on browser X, live with it"
You can't say that to public facing clients. I mean you can try, but have fun losing business to your competitors.
Re-develop your website to match the W3C HTML/CSS standards and the ES5 standards and it will be completely future facing (for some years).
Alas, the way the web works is that anything more then 5 years old is deprecated. So either re-write it every 5 years or get out of the web business.
In terms of actually using compatibility mode, don't. IE6-8 are horrible engines and should be avoided like the plague. If you use them then you can't write future facing standards compliant code.
Your code needs to match the standards and you should fix / shim / patch any browser specific bugs where those browsers don't implement the standards.
你不能说你已经在 IE6/7/8/9 中进行了测试,除非你在这些不同的版本中进行了测试。模拟测试环境与使用测试环境不同。据我所知,IE7/8 兼容模式是较旧的渲染引擎,而不是整个底层浏览器,包括错误等。它是闭源的,所以你永远不会知道。
将 Microsoft 免费下载的用于跨浏览器测试的虚拟磁盘映像转换为 Virtualbox 映像,并将它们放在仅运行 Virtualbox 的计算机上。一台旧机器就可以,无头运行虚拟机并通过远程桌面访问它们。通过这种方式,您将能够在所有浏览器中进行测试,而不会给您的计算机带来 MS/Spyware 的负担。
You cannot say you have tested in IE6/7/8/9 until you have tested in those different versions. Emulating the test environment is not the same as using the test environment. To my knowledge IE7/8 compatibility modes are the older render engines, not the underlying browser as a whole, bugs and all. It is closed source so you will never know.
Convert Microsoft's free to download virtual disk images for cross-browser testing to Virtualbox images and put them on a machine that just runs Virtualbox. An old machine will do, run the VMs headless and access them with remote desktop. In that way you will be able to test in all browsers without burdening your machine with MS/Spyware.
我相信您的系统管理员可以使用组策略编辑器将 IE 设置为所有 Intranet 流量的兼容模式。从现在开始,您创建的任何网站都可以添加一个元标记来强制 IE9 本地渲染并使用所有较新的功能...
我必须在我当前的项目中使用以下 doctype 和元标记来执行此操作我的标题:
I believe your system admins can set IE to compatibility mode for all intranet traffic using the Group Policy Editor. Any site you create will from this point forward, you can add a meta tag to force IE9 to render natively and use all the newer features...
I'm having to do that on my current project using the following doctype and meta tag in my header:
兼容模式是微软推出的,是为了给人们一些升级应用程序的机会,而不是为了长期使用。阿法尤。
如果您希望您的应用程序与 IE9 兼容,那么您必须对其进行更改。如果您试图保持 IE6-9 兼容性,那么您将面临真正的挑战,并且您应该考虑这是否真的实用 - 本质上,您至少需要 2 组不同的 html。这对你来说实用吗?
IE9 兼容模式与 IE9 和 IE8 不同 - 它从两者中提取位。因此,您需要对兼容模式版本进行全面测试,并确保它仍然可以正常工作。
因此,在回答这个问题时,缺点是您不兼容 IE9,并且存在当 IE10 出现时您的代码在任何模式下都无法运行的危险。您将精力投入到兼容性测试中,而没有为未来的更改做好准备。从长远来看,您会做得更好,使您的代码兼容 IE9。此外,您向客户传达的信息是您的代码库将不会兼容太久。除非你和他们谈论返工,否则这是一个真正的负面影响。
然而,听起来您的整个代码需要重新编写,以忘记 IE6 并为现代工作浏览器编写。在此之前使用兼容模式可能是可以的。如果您这样做 - 并告诉您的客户 - 那么保持兼容模式是可行的。
Compatability mode is something that MS introduced to give people some chance to upgrade their applications, not for long term use. AFAIU.
If you want your application to be compatible with IE9, then you will have to change it. If you are trying to maintain IE6-9 compatibility then you have a real challenge, and you should consider whether this is really practical - in essence, you need at least 2 distinct sets of html. Is this practical for you?
IE9 compatibility mode is different form IE9 and IE8 - it draws bits from both. So you need to do a full test agaisnt the compatibility mode version, and ensure that it remains working against this.
So in answer to the question, the cons are that you are not being IE9 compatible, and there is a danger that when IE10 comes out, your code will not run against that in any mode. You are putting the effort into compatibilty testing without providing for future changes. You would do better, in the longer term, to make your code IE9 compatible. Also, the message you are giving your clients is that your code base is not going to be compatible for much longer. Unless you are talking to them about a re-work, this is a real negative.
However, it sounds like your entire code needs a re-work, to forget about IE6 and be written for modern working browsers. Using compatibility mode until that happens is probably OK. If you do this - and tell your clients - then staying in compatibility mode is viable.
使用兼容模式不会导致浏览器使用旧版 IE 中存在的 JavaScript 引擎。
我的意思是它将使用 IE9 引擎运行任何 JavaScript 代码。当我们调试一个 IE7/8 有问题的旧产品时,这对我们来说是一个问题。
Using compatibility mode will NOT cause the browser to use the JavaScript engine that was present in the old version of IE.
By that I mean it will run any JavaScript code using the IE9 engine. Which was a problem for us when debugging an old product that had a problem with IE7/8.