简体   繁体   English

使用 Internet Explorer 兼容模式的缺点

[英]Cons of using Internet Explorer's Compatibility Mode

What are cons of force a web site viewed in IE to compatible mode?在 IE 中查看到兼容模式的 web 站点有什么缺点? Say we force IE9 to IE8 compatiblity mode ?假设我们强制 IE9 到IE8 兼容模式

  • Performance drawbacks性能缺陷
  • Can't use any new IE9 specific features like HTML5/CSS3/SVG无法使用任何新的 IE9 特定功能,例如 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.我们运行自 2000 年以来开发的旧版 web 应用程序,因此要与 Chrome、Opera、Firefox、IE6/7/8 兼容是一场混战,现在我们决定将 IE9 添加到列表中。 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.但是对于 IE9,我们遇到了打印问题,“Permission deniend”JavaScript 错误(可能与跨框架 JavaScript 调用有关)和下一个问题 - 简单的解决方法是强制 IE9 像 IE8 一样运行,然后一切正常。 But I am still not sure if it's way to go...但我仍然不确定它是否可以到达 go ......

first our app is public site (for our clients)首先我们的应用程序是公共网站(对于我们的客户)

You have a public website developed in 2000 and it doesn't work on modern browsers?您有一个 2000 年开发的公共网站,但它不能在现代浏览器上运行? 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"唯一可以摆脱这种不兼容性的地方是 Intranet 应用程序,即使这样,您也应该简单地 state “它适用于浏览器 X,可以使用它”

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).重新开发您的网站以符合 W3C HTML/CSS 标准和 ES5 标准,它将完全面向未来(几年)。

Alas, the way the web works is that anything more then 5 years old is deprecated.唉,web 的工作方式是不推荐使用超过 5 年的东西。 So either re-write it every 5 years or get out of the web business.所以要么每 5 年重新编写一次,要么退出 web 业务。

In terms of actually using compatibility mode, don't.就实际使用兼容模式而言,不要。 IE6-8 are horrible engines and should be avoided like the plague. IE6-8 是可怕的引擎,应该像瘟疫一样避免使用。 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 .您的代码需要符合标准,并且您应该修复/填充/修补那些浏览器未实现标准的任何特定于浏览器的错误。

You cannot say you have tested in IE6/7/8/9 until you have tested in those different versions.你不能说你已经在 IE6/7/8/9 中进行了测试,除非你在这些不同的版本中进行了测试。 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.据我所知,IE7/8 兼容模式是较旧的渲染引擎,而不是作为一个整体的底层浏览器、错误等等。 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.将微软免费下载的用于跨浏览器测试的虚拟磁盘映像转换为 Virtualbox 映像,并将它们放在只运行 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.通过这种方式,您将能够在所有浏览器中进行测试,而不会给您的机器带来 MS/Spyware 的负担。

I believe your system admins can set IE to compatibility mode for all intranet traffic using the Group Policy Editor.我相信您的系统管理员可以使用组策略编辑器将 IE 设置为所有 Intranet 流量的兼容模式。 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...从现在开始,您创建的任何网站都可以添加元标记以强制 IE9 原生呈现并使用所有较新的功能...

I'm having to do that on my current project using the following doctype and meta tag in my header:我必须在我当前的项目中使用 header 中的以下文档类型和元标记来执行此操作:

<!DOCTYPE HTML >

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

Compatability mode is something that MS introduced to give people some chance to upgrade their applications, not for long term use.兼容模式是微软引入的,目的是让人们有机会升级他们的应用程序,而不是长期使用。 AFAIU. AFAIU。

If you want your application to be compatible with IE9, then you will have to change it.如果您希望您的应用程序与 IE9 兼容,那么您将不得不对其进行更改。 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.如果您试图保持 IE6-9 兼容性,那么您将面临真正的挑战,您应该考虑这是否真的实用 - 从本质上讲,您需要至少 2 组不同的 html。 Is this practical for you?这对你实用吗?

IE9 compatibility mode is different form IE9 and IE8 - it draws bits from both. IE9 兼容模式与 IE9 和 IE8 不同 - 它从两者中获取位。 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.所以在回答这个问题时,缺点是你不兼容 IE9,并且当 IE10 出现时,你的代码可能不会在任何模式下运行。 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.从长远来看,您会做得更好,以使您的代码与 IE9 兼容。 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.然而,听起来你的整个代码需要重新工作,忘记 IE6 并为现代工作浏览器编写。 Using compatibility mode until that happens is probably OK.在发生这种情况之前使用兼容模式可能没问题。 If you do this - and tell your clients - then staying in compatibility mode is viable.如果你这样做——并告诉你的客户——那么保持兼容模式是可行的。

Using compatibility mode will NOT cause the browser to use the JavaScript engine that was present in the old version of IE.使用兼容模式不会导致浏览器使用旧版 IE 中存在的 JavaScript 引擎。

By that I mean it will run any JavaScript code using the IE9 engine.我的意思是它将使用 IE9 引擎运行任何 JavaScript 代码。 Which was a problem for us when debugging an old product that had a problem with IE7/8.这对我们来说是在调试 IE7/8 有问题的旧产品时遇到的问题。

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

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