Trying to use IE=edge X-UA-Compatible in an iframe on a page using IE=EmulateIE7
Asked Answered
D

1

28

I have a page that's going to be included in an iframe on a page where they use the following:

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

and ideally I'd like to render my page in using the latest standards mode available to the browser the user is using. Is this possible?

I've tried including

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

on my page, as well as altering my webapp to include the 'X-UA-Compatible' HTTP header with value of 'IE=edge', but I can't seem to get it to do what I want.

The odd thing is, is that if for instance I have two pages, the first containing the iframe and the other being what's displayed in the iframe, like so:

<!doctype html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <script>
        console.log("Page document mode: "+document.documentMode);
    </script> 
</head>  
<body>
<iframe src="iframepage.html" /> 
</body>
</html>

and

<!doctype html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <script>
        console.log("Iframe document mode: "+document.documentMode);
    </script> 
</head>
<body>
</body>
</html>

The output is the rather unexpected

Page document mode: 7
Iframe document mode: 8

Where has the document mode 8 come from? And how do I make the iframe document into 9 or above??

I'd be eternally grateful if someone can point me in the right direction!! thanks, Nick

Dethrone answered 28/9, 2012 at 14:0 Comment(3)
I have the exact same problem. Did you find a solution ?Doctor
Unfortunately, I'm afraid notDethrone
Just guesses, but a couple things to try would be 1) setting IE=9 rather than edge, and/or 2) using the X-UA-Compatible http header, rather than the meta tagIndispose
S
22

IE does not allow mixing IE9+ and older modes in a frame hierarchy. If your top document is IE7, the highest you can get in any inner document is IE8. Similarly, you wouldn't be able to host anything but IE9 mode docs inside an IE9 mode page.

Scorify answered 22/2, 2013 at 9:13 Comment(4)
It appears though, it's possible to mix modes the other way round: the main page in standard mode, the frame in compatibility mode: https://mcmap.net/q/504673/-main-web-page-in-standard-mode-iframe-in-compatibility-mode-any-issues/1768303Synonymy
It is important consider the source on issues that are easily confusing like this one: msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspxWeft
@Noseratio I've looked at your example in your other question, and I believe in your inner frame you're not seeing a true IE5\Quirks mode, but rather something called "Almost Standards Mode", which is almost the same as standards except for the table behavior you mention. More info here: msdn.microsoft.com/en-us/library/ff405912(v=vs.85).aspx . It's great if this works for you, but things other than tables will not work as you'd expect from a pure legacy mode.Scorify
"Windows Internet Explorer 10 and Internet Explorer 11 both use Quirks Mode emulation if the top-level page is not in Edge Mode." IE9: "If the top-level page is not in IE9 mode, the iframe element cannot render its contents in IE9 mode, even if the web developer specifies it." - msdn.microsoft.com/en-us/library/ff955402(v=vs.85).aspxRomine

© 2022 - 2024 — McMap. All rights reserved.