简体   繁体   中英

How do I override internet explorer emulation in an iframe?

The company I work for currently forces the users that visit the site with IE to emulate IE8. I need to put an Iframe in but the content within the Iframe will only work with IE9 and above. These are the 3 options I've added to the iframed page to override the parent pages IE8 emulation.

I've added this to the header:

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

and I've tried these scripts:

<!--[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]-->

Is anyone aware any alternatives that would override the parent pages emulation of IE8 or am I doing something wrong?

This is not possible, unfortunately. According to Microsoft's help pages, web pages cannot display in multiple document modes, with the exception of IE10, which can display a frame in Quirks Mode that is a child of a Standards Mode page:

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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