Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
641 views
in Technique[技术] by (71.8m points)

internet explorer - Trying to use IE=edge X-UA-Compatible in an iframe on a page using IE=EmulateIE7

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...