IE11 quirks mode under Iframe - javascript errors - javascript

I am reading and looking for answer for days and couldn't found one, hopefully this thread will bring salvation :)
In my company we have a web app that is working on IE8.
We are trying to migrate to IE11.
We almost there but,
We have an old module that is written in an old framework that is hosted in an iframe and running in quirks mode(define with meta http-equiv="X-UA-Compatible" content="IE=emulate7" or IE=5, I tried both).
As long as the parent/main window is rendered in IE8 document mode (via x-ua-compatible meta tag) or in enterprise mode, the iframe works fine.
But as soon as I change the parent/main window to IE=9 and above, I get javascript errors from the child iframe (more than I can handle).
I understand that IE11 uses emulator for quirks mode and not the real engine, but I can not find anywhere details about the javascript engine.
Does this mean that if the parent main window is rendered is IE9 and above, the child iframe will use ECMAscript 5 and not jscript as it should?
is there any solution to my problem?
thanks guys!

Starting with IE10, the child mode can be different from the parent.
See this link. It says...
IE9 mode displays the child frame in standards mode (because the
parent document is in standards mode). Starting with Internet Explorer
10, however, child frames can emulate quirks mode. For more info, see
IEBlog: HTML5 Quirks mode in IE10. For best results, however, use
document modes consistently.

Starting with IE9, frames were limited to the document of the parent document, e.g. if the parent document rendered in standards mode, child frames were forced to render likewise.
Perhaps one approach would be to revise things so that your IE9+ window presents links to open your legacy app in a new parent window, one that presents whatever document mode your child frame requires.
You can use showModelessWindow to open a child window containing a separate HTML file, one that initiates the correct document mode in the parent document...and then loads the IFRAME you're working with. Example code:
var sOptions = "scroll: no; status: no; resizable: yes;";
window.showModelessDialog("myFrameContainer.html", "", sOptions );

Related

Need to force IE11 to IE7 using X-UA-Compatible

When I kept the tag meta tag 'meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"' in header tag of my jsp, but jsp is in under nested of another jsp like showed in the image.
But i cannot kept in the above jsp, because it's controlled by some other team.
I need to force the Internet explorer to IE7 could someone help me to this without change in system properties
This appears to be impossible as of IE9 - from How Internet Explorer Chooses Between Document Modes (emphasis added):
In Internet Explorer 9, if the document is hosted in an iframe element, the document mode is determined by the document mode of the
top-level webpage. Subdocuments cannot be rendered in IE9 mode unless
the top-level document is also in IE9 mode.
I would assume this rule also applies to framesets - and different document modes - as in your case.
For a more recent look at how IE11 decides which document mode to render in, take a look at Deprecated document modes and Internet Explorer 11, which contains a flowchart of the process.

Changing src of iframe in IE5 quirks mode cause full page change

I have content that is loaded into a standard frame. I have no control over the parent frame which is forcing the browser into IE5 Quirks mode. Now within my own content I am attempting to change the src of an iframe. I am using the following code:
function loadIframe(iframeName, url) {
var $iframe = $('#' + iframeName);
if ( $iframe.length ) {
$iframe.attr('src',url);
return false;
}
return true;
}
loadIframe('frameID', '../myhtmlpage.html');
The issue is that when I attempt to load the new src into the iframe, the entire window reloads. I am pretty sure that this is related to IE5Quirks mode because if I pull up IE Developer tools and change to Standards mode, the iframe loads as expected. How can I get the iframe to load without issues?
From your comment:
I don't have any control over the page that is being rendered in quirks mode; however, my content must be loaded into a standard frame on that page.
I'm afraid to tell you that you are out of luck.
IE does not support mixed rendering modes between frames on the same page. If the main page is in quirks mode, then all frames or iframes within that page will also be in quirks mode, even if they are written to be standards compliant.
This just how it works, and you cannot override it.
Your options, as I see them:
Find a way to upgrade the parent page so that it no longer needs Quirks mode. (I appreciate that this option may not be open to you, but frankly it's shocking that anyone is still using quirks mode in 2015; the managers who think they're saving money by not upgrading whatever obsolete system this is need to be given a wake-up call)
Downgrade your page so it can work in quirks mode. Note that if you're using any modern browser features, then this option may not be possible as Quirks mode will disable those features in the name of being compatible with IE5.
Open your content in a pop-up window instead of a frame. This seems like it's probably the most pragmatic option. It's almost certainly going to be the least amount of work (be an order or magnitude). It may not look as good as if it's in an iframe, but at least it'll work.

IE 11 document mode for iframe page when parent page is running in edge mode

Problem - We are trying to migrate our application to use IE Edge mode (we are using IE 11 browser). Our application consists of a top level page and a child iframe to load third party applications (which may load from a domain which is different from parent page domain). As part of migration, parent level page now loads in Edge mode (using IE=Edge value for X-UA-Compatible meta tag)
Question - Can i be absolutely sure that iframe page will always render in Edge mode as well (irrespective of its malformed content or the use of X-UA-Compatible meta tag with a different content value)? Is there any official msdn document confirming the same?
Note:
I checked this msdn link, but it mainly explains IE9 behavior, and it also talks about the case where an iframe cannot have document mode higher than that of parent page.
Based on my understanding, the accepted answer to this question seems to indicate that iframe will also render in Edge mode, but i am not entirely sure.
Any help is appreciated! Thank you.
As from https://msdn.microsoft.com/en-us/library/jj676915%28v=vs.85%29.aspx :
As of IE9 mode, webpages cannot display multiple document modes. For
example, consider a standards-based webpage that contains a frame
element that displays content in quirks mode. IE9 mode displays the
child frame in standards mode (because the parent document is in
standards mode). Starting with Internet Explorer 10, however, child
frames can emulate quirks mode. For more info, see IEBlog: HTML5
Quirks mode in IE10. For best results, however, use document modes
consistently.
This means that If you set the X-UA-Compatible meta tag, if IE version is newer than 9 it will display the current window and all child browsing contexts in Edge mode. If the IE version is 8 (the version in which this meta tag is introduced), this can render child contexts using different rendering mode.

Can an iframe content be rendered in Quirks mode when the parent is rendered in Standards mode? [duplicate]

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

Changing IE Document Mode via Bookmarklet

I am currently in development of a bookmarklet that triggers a fancybox Iframe when an image is clicked on a website. This bookmarklet works great in all browsers except IE 9's Quirks Mode. In fact, it not only screws up the rendering of items on the screen, but items within the Iframe as well. I'm looking for a solution to force IE into standards mode. Especially on pages where there is no Doctype declared. In fact a static image on a page is our current test for the bookmarklet.
Success equals -
1. Launching the bookmarklet on a Quirks Mode page
2. Having the fancybox iframe load in the proper location on screen with proper rendering
Thanks in advance for any help that can be provided.
I'm looking for a solution to force IE into standards mode.
I'm pretty sure there is no way. Changing the rendering mode with Javascript just wouldn't be a scenario that anyone would consider necessary or beneficial; your use-case is just too obscure.
Success equals - 1. Launching the bookmarklet on a Quirks Mode page 2. Having the fancybox iframe load in the proper location on screen with proper rendering
If fancybox won't work, then try out alternative solutions: http://www.google.com/search?q=jquery%20lightbox

Categories

Resources