Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

IE8 compatibility-mode w/ document.domain change

Dan Watson
1 decade ago Sep 04, 2012 3:27pm

Im developing an intranet application using vaadin that needs to display and interact with an iframe on a different host (same sub-domain).

To handle these requirements it is necessary to set the Javascript "document.domain" on both frames to an identical sub-domain to satisfy the same-origin policy. This is happening just fine.

Everything works fine in Firefox, the application functions perfectly - and in vanilla IE8 it works fine as well. However, the entire framework breaks when using IE8 in compatibility mode (which should operate as IE7). FYI - IE8 by default, loads all intranet applications in compatibility mode. Unfortunately there is no general workaround for this, so we're stuck with it. By "the entire framework breaks", I mean that the application does not load at all due to a Javascript error.

I tracked down the JS error to the "__gwt_historyFrame" iframe. For some reason IE8 does not like the fact that the "document.domain" property was changed, and it refuses to allow the framework to interact with the __gwt_historyFrame iframe. As soon as the framework accesses: "frame.contentWindow.document" - IE throws an "Access Denied" error, and the application stops loading.

Does anyone know a workaround for this? Is IE8 compatibility mode even officially supported? Is changing document.domain supported? Im using some custom build logic to ensure that documents change their domain when loaded - which works fine - but is there a more standard method?