如何覆盖 iframe 中的 Internet Explorer 仿真?

How do I override internet explorer emulation in an iframe?

我工作的公司目前强制使用 IE 访问该站点的用户模拟 IE8。我需要放入一个 Iframe,但 Iframe 中的内容仅适用于 IE9 及更高版本。这些是我添加到 iframed 页面以覆盖 parent 页面 IE8 仿真的 3 个选项。

我已将此添加到 header:

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

我试过这些脚本:

<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!--[if IE> <script> if (!document.documentMode || (document.documentMode < 9)) { document.write("<script src="http://html5shiv.googlecode.co..."></script>”); } </script> <![endif]-->

是否有人知道任何替代方案会覆盖 IE8 的 parent 页面模拟,或者我做错了什么?

不幸的是,这是不可能的。根据 Microsoft 的帮助页面,网页无法在多种文档模式下显示,但 IE10 除外,它可以在标准模式页面的子页面的 Quirks 模式下显示框架:

As of IE9 mode, webpages cannot display multiple document modes. For example, consider a standards-based webpage that contains a frame element that displays content in quirks mode. IE9 mode displays the child frame in standards mode (because the parent document is in standards mode). Starting with Internet Explorer 10, however, child frames can emulate quirks mode. For more info, see IEBlog: HTML5 Quirks mode in IE10. For best results, however, use document modes consistently.

来源:https://msdn.microsoft.com/en-us/library/jj676915%28v=vs.85%29.aspx