NOTE: Sorry, I don't yet have code to support this article (sensitive production code only). I will attempt to provide a concise working sample if time permits later. I wanted to publish this in the hopes it can offer hints to others in tracking down similar issues.
Hiding all "formScreen" DIVs after submitting causes IE9 to completely crash.
Originally I define a formScreens variable:
var formScreens = $(".formScreens");
then later call:
$(formScreens).hide();
which causes IE to crash.
I also tried the following, and both options also cause the crash:
var copyOfFormScreens = $("div.formScreen");
$(copyOfFormScreens).each(function ()
{
$(this).hide(); // Option 2: This fails too.
$(this).css("display", "none"); // Option 3: This fails too.
});
The following was returned by IE when crashing:
Problem signature: Problem Event Name: APPCRASH Application Name: IEXPLORE.EXE Application Version: 9.0.8112.16496 Application Timestamp: 51a55c6d Fault Module Name: MSHTML.dll Fault Module Version: 9.0.8112.16496 Fault Module Timestamp: 51a55ff0 Exception Code: c00000fd Exception Offset: 0032ef01 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 3081 Additional Information 1: 39a4 Additional Information 2: 39a4d7f18c1c7c725934453009d2f1b9 Additional Information 3: ddcf Additional Information 4: ddcfafd1b35f05f847ac8d3e7a7bcf12
And the following when debugging in Visual Studio:
Unhandled exception at 0x6302EF01 (mshtml.dll) in iexplore.exe: 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x02432F68). Unhandled exception at 0x630A172B (mshtml.dll) in iexplore.exe: 0xC0000005: Access violation writing location 0x02430FFC. // This error continued to show when pressing the debug "continue".
There is a very simple workaround I discovered.
Before hiding the desired elements I set the focus to an element "outside" the DIVs that are hidden (i.e. an element that is still visible after the screen DIVs are hidden). In my case, I set the focus to the first container DIV in the page, which turns out to be an ancestor for DIVs being hidden.
An idea of how the DIV layout looks:
<div class="mainContent">
<div class="fromScreen">
</div>
<div class="fromScreen">
</div>
<div class="fromScreen">
</div>
</div>
So the code I now call is:
$(".mainContent").trigger("focus"); // Call this before the hide.
formScreens.hide(); // Crashes on submit if focus is not set to higher element first.
If hiding a DIV with elements that have focus prior to hiding causes issues, move the focus to an element outside the DIV being hidden.
(My workaround was inspired by the first response at http://www.3dvia.com/forums/topic/urgent-crash-in-internet-explorer-when-trying-to-hide-the-experience)
I have a workaround as well. If you set explicitly the "visibile" CSS property to "Visible" value than hide the outer div (set Visible to Collapse), it works. Without this step, IE crashes.
However this solution does not work in other browsers, because the internal content still remains visible. So, I just simply detect the browser type than in IE I set the internal DIVs visibility to "Visible", in other browsers to "Inherit".
The behavior of the IE is strange, because it will hide the entire content as I originally expected, however the logical working is to keep internal content are visible as in other browser.
The crash is a bug in IE, it still exists in IE11 too.
Example for IE:
<div id="outerDiv">
<div style="visibility:visible">To hide</div>
</div>
Example for other browsers:
<div id="outerDiv">
<div style="visibility:inherit">To hide</div>
</div>
Now set "outerDiv" Visibility to Collapse.
User contributions licensed under CC BY-SA 3.0