سؤال

I have a frame that needs compatibility 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 compat mode to only the frame, or have the frame apply compat 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.

هل كانت مفيدة؟

المحلول

So 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.org/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);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top