Force IE8 emulation in IE10 iframe - html

My company recently migrated from IE8 to IE10
I need to emulate IE8 in order to display page properly in IE10
This is the structure of my page:
I want main page and iframe to render in IE8 mode, but only main page is rendered in IE8 mode (content in iframe is rendered in IE10 mode). In both main page and iframe content I have:
tag <!doctype html> and metadata X-UA-Comapatible: IE=EmulateIE8
If I run content of iframe separamelly it is rendered in IE8 mode.
How to force IE10 to use IE8 mode also in iframe?

The "emulate" values tell IE to follow the default behavior; that is, to use the mode it would normally use based on the document type declaration (doctype).
Since you're using the HTML5 doctype, this would lead IE to choose edge mode, the latest and greatest mode available to that version of IE.
To restrict things to a specific mode, specify that in your content attribute value, e.g. content="ie=8"
Note that you may need to do this for both the parent and the child iframe. (There's a specific set of parsing rules in certain versions that allow you to mix standards modes, but that's even more confusing, so it's best to be consistent throughout.)
See Specifying legacy document modes for more info.
Hope this helps...
-- Lance

Related

IE issue with compatibility modes

I was wondering when I put my browser in compatibility mode, how does it know what setting to use from the header tags found in the document. If we have logic for all versions back to EI7, will it use the furthest back? So in this case, it chooses 7 in comp mode, but if we only offered back to IE8, then it would choose IE8 for that instance? So the question is, why does IE 11 compatibility mode set it to IE7 standards according to my debugger in IE? If I remove the [if IE7] code snippet, will it then set it to IE8 standards in the browser? We just quit supporting IE7 so am why I am asking this.
[if IE 7 ]> <html class="ie7"
[if IE 8 ]> <html class="ie8"
[if IE 9 ]> <html class="ie9"
In addition, the way you view your pages also affects the document mode.
If you view a page on the Internet (or through a local web browser), the page opens in the Internet zone. In this case, the x-ua-compatible directive takes precedence; depending on the setting, the <DOCTYPE> may also have an impact.
If you open the page using the File menu, from File Explorer, or from a network path, the page opens in the Intranet zone. By default, this means your page opens in IE7 compatibility mode, though that can be changed through settings.
Apps hosting the webBrowser control default to IE7 unless you override that using a registry change. (Note, it's currently unclear whether this is supported in Windows 10).
For best results:
Use the HTML5 <DOCTYPE> directive.
Use an x-ua-compatible meta with content set to IE=edge.
View local pages through a local webbrowser.
Code for HTML5, detect features, provide graceful fallback, and worry less about individual differences between individual browsers.
Hope this helps...
-- Lance
The code you've quoted in the question does NOT tell IE what mode to use. What this code does is look at the mode that IE is already in, and react accordingly.
Therefore, the answer to your question is: No: Removing the IE7-specific block from this code will not stop IE going into IE7 mode.
If you want to force IE to go into a specific mode, the code you need to use is the X-UA-Compatible meta tag.
You need a line near the top of you HTML that looks like this:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Putting edge in the content tells IE to use it's best available mode (so IE11 will be in IE11 mode). If you want a specific IE mode, then put IE8 or similar instead of edge.

How to alter ie Browser Mode?

I found a lot of links that said adding
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
or an older version of DOCTYPE forces the browser into compatibility mode. But after repeated attempts with many combinations, seems to me that all it does is alter the Document Mode and NOT the Browser Mode
I bet if you just remove your DOCTYPE tag completely or make it invalid that IE will be forced into compatibility view. Broken markup of some sorts will force this mode. However, this will surely have other negative consequences for non-IE browsers.
You would like to force IE into compatibility mode?
Also, I don't believe IE will display compatibility mode in the console window.
Are you sure you don't mean quirks mode?
The browser mode function (as I understand it) in IE isn't exactly compatibility mode.
I'm just going to copy/paste from the official documentation below.
Browser Mode
Description
IE9
IE9 reports a UA string, version vector, and document mode to match the default browser behavior, which is the most standards-compliant mode in IE9. Use this mode to test how IE9 users experience your site.
IE9 Compatibility View
IE9 reports a UA string, version vector, and document mode, as if it is IE7; however, the UA string also includes the Trident/5.0 token indicating that the browser is really IE9. Use this mode to test how IE9 users experience your site if they click on the Compatibility View button.
IE8
IE9 reports a UA string, version vector, and document mode as if it is IE8. Use this mode to test how IE8 users experience your site.
IE7
IE9 reports a UA string, version vector, and document mode as if it is IE7. Use this mode to test how IE7 users experience your site.
The only way to force this to change no matter what, is to set it on the virtual directory level through IIS in the 'HTTP Headers' section of the properties menu. Changing it here will force the browser into whatever mode you set it to, 100% of the time.
Changing the setting here overrides whatever browser mode is specified at the web page level.
You can't. The Browser Mode is intended to be used by developers to see what their browser would look like with new features disabled (for instance, if I put my IE10 into the IE8 Browser Mode, it will no longer support border-radius, or anything else that was added).
Since it's a developer tool, there is no need for it on the regular user's side.
The Document Mode, on the other hand, involves how the document is rendered, not how it is supported. I can have my document in IE8 mode and still have rounded corners because the browser mode supports it.
That being said, you should ALWAYS use this:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
If I see a site with a X-UA-Compatible header that contains anything else, I assume that the developer is a lazy bastard.

How to force Iframe to run quirks under a standard parent frame

We have a parent page that must run in IE9 standard mode, executing HTML5 commands.
Underneath we have an iframe that must run in compatibility mode (IE7/8).
In IE9, as I understand, iframes inherits their doctype from parent. is that correct?
Is there any solution for this issue? can , somehow, iframe be executed with quirks doctype under standard mode doctype parent frame?
thanks,
Tal
It's not possible to trigger a different rendering mode in a child iframe in IE9, as officially documented here: http://msdn.microsoft.com/en-us/library/gg558056(v=vs.85).aspx (emphasis added):
Although the newer rendering engine is only used when Windows Internet
Explorer detects that an HTML page has requested the highest level of
support for standards, the same is not always true for child pages
that might be loaded within frame and iframe elements. Because only
one rendering engine can be active at a time, IE9 Mode also includes
emulation for Quirks Mode.
However, as it says, you can trigger "quirks mode emulation" which leaves the IE9 rendering engine active but alters its behavior in several ways to match the old quirks mode.
JSBin demo: http://jsbin.com/ozejuk/1/
This example has a div with style background: #ff0000; background: 00ff00; border-radius: 30px ... in quirks mode, hex colors without # are accepted. In IE9 mode they are not. Loading the demo in IE9 will show a red div in the parent page, and a green div (but still with rounded corners) in the iframe.
How to trigger quirks mode emulation in an iframe: http://msdn.microsoft.com/en-us/library/gg558096(v=vs.85).aspx
Short version: omit DOCTYPE, add: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
Complete list of effects quirks mode emulation has on rendering: http://msdn.microsoft.com/en-us/library/gg558047(v=vs.85).aspx

Emulate IE7 in IE9. What is the default?

I'm currently working on a site that has uses the Emulate IE7 meta tag like this:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
As far as I know and as far as I've googled this tag also addresses IE9, forcing it to go into IE7 compatibility mode.
However I noticed that one of the devs on the project is viewing the page in IE9-mode, not in compatibility mode.
How does this work? Is compatibility mode the default setting in IE9, when the Emulate IE7 meta tag is set? Would one have to manually change a setting in IE9 to bypass the Emulate IE7 meta tag?
The Developer Toolbar in IE9 (and IE8) allows you to change the browser mode-- including forcing display using the IE9 rendering engine.
For more information, read this MSDN article: http://msdn.microsoft.com/library/dd565628(VS.85).aspx#browsermodes

Run quirks mode in one frame and standards mode in another?

I have an old application that uses frames (not iframes) was was written back in the IE6 days so it runs in quirks mode.
Is it possible (Using IE 7 or 8) to have one frame still in quirks mode and another in standards mode or must the whole browser be in one mode or another?
I've been trying with no success.
I've seen this answer, that applies to iframes, but what about plain-old-frames?
I believe that you don't get the same option with frames as you do with an iframe. As the linked question's answer stated, the target in an iframe is not dependent upon the parent. In regular frames the pages all rely on the parent. I don't think you can separate the types out.
I'm not sure if this helps, but according to the Mozilla Dev center Firefox makes it's quirksmode decisions based on doctype only.
https://developer.mozilla.org/en/Mozilla's_DOCTYPE_sniffing
You'll notice using the old frameset doctype triggers "almost standards" mode, which could show up as quirksmode.
See my answer here for MSDN-documented solution for IE9: How to force Iframe to run quirks under a standard parent frame
In short, it is not possible to trigger quirks mode in a frame (or iframe) if the parent page is rendering in IE9 mode, but it is possible to trigger "quirks mode emulation" embedded in the IE9 rendering engine.
JSBin demo: http://jsbin.com/ozejuk/1/
Further reading: http://msdn.microsoft.com/en-us/library/gg558056(v=vs.85).aspx
If you can modify the code (or HTML) of the application, you can add a meta tag (just below head), so it forces IE to render it in Quirks mode, like this:
<meta http-equiv="X-UA-Compatible" content="IE=5">