I have a frame that needs patibility mode but parent frame seems to be setting it so the following tag inside the frame does nothing.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
Is there anyway to apply pat mode to only the frame, or have the frame apply pat mode to the parent frame.
Was thinking if there is a javascript method to switch modes I could apply it to the parent frame from the child frame.
I have a frame that needs patibility mode but parent frame seems to be setting it so the following tag inside the frame does nothing.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
Is there anyway to apply pat mode to only the frame, or have the frame apply pat mode to the parent frame.
Was thinking if there is a javascript method to switch modes I could apply it to the parent frame from the child frame.
Share Improve this question edited Jul 17, 2012 at 10:31 Anish Gupta 2,2262 gold badges23 silver badges37 bronze badges asked Mar 29, 2012 at 17:47 SerhiySerhiy 2,5553 gold badges34 silver badges49 bronze badges 6- Unfortunately that can't be done. In IE frames always use the rendering mode of the parent document. I'm assuming that since you can't change the parent document that they are not on the same domain so cross-domain boundaries would prevent you from changing the parent doc's rendering mode from the frame. – pseudosavant Commented Mar 30, 2012 at 20:25
- I am on the same domain, but this is a big legacy app, thousands of pages. Simply setting patibility mode on the whole shebang seems like asking for more trouble down the road when IE7 support begins to be phased out. However if I can have the child change the parent's doc on one page, that's precisely what I would like. Cross-domain boundaries are not an issue in my case. – Serhiy Commented Mar 31, 2012 at 3:43
- If you open the iframe with open, then the iframe will have access to opener to do something like opener.set_XUA("IE=EmulateIE7"). To have that, you can use open with the name of the iframe as target, so it use the iframe to open there the page. This can be more trouble than it deserve. – Tei Commented Apr 2, 2012 at 11:14
- I see, though I'm afraid I can't open the frame in a new window. It's actually not an iframe but good ol frames, with one frame being navigation. – Serhiy Commented Apr 2, 2012 at 14:07
- How many pages will this frame that needs IE7 mode be used on? If it is only on a few pages then you could just set the necessary custom headers for just that page via htaccess or IIS's admin controls. – pseudosavant Commented Apr 3, 2012 at 14:19
2 Answers
Reset to default 2So here's what I've gathered.
The only thing that seems to work is the meta tag way.
However, it doesn't appear to work in frames as IE9 has disabled the ability of one frame to be of different type than another.
The meta tag also can't be preceded by script or link tags, only and other meta tags from what I've noticed, otherwise it fails as well.
TEST CASE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Test test</title>
<meta name="keywords" content="keywords, keyword, keyword phrase, etc.">
<!--<link href="test.css" rel="stylesheet" type="text/css" />-->
<!--<script type="text/javascript">alert('test');</script>-->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
</head>
<body>
inline-block <div style="display:inline-block">test</div>
</body>
</html>
From top of my head you can try to create meta tag and insert it in the parent frame head. I'm not sure though if that would force the emulation.
var meta = document.createElement('meta');
meta.setAttribute('http-equiv', 'X-UA-Compatible');
meta.setAttribute('content', 'IE=EmulateIE7');
parent.document.getElementsByTagName('head')[0].appendChild(meta);