IE modal dialog crash issues

Everyone who has worked with modal dialog windows, a feature of the IE browser knows the irritants of using it. JavaScript debugging is difficult, you cannot do ‘view source’ and plugins like the IE Dev Toolbar just do not work on the modal windows.

I needed to refresh a screen on a button event in a modal dialog. Rats! HTML form submit does not work on modal dialogs.

I redesigned it to close the current modal dialog on form submit and then open a new modal window again from the parent. How? I passed the window object from the opened modal Dialog to the parent by invoking a method.

for e.g.

function openNewModal(url) {

parentWindowObj.openNewModal(window, url);

}

In the parent, I did

function openNewModal(modalWindow, url) {

modalWindow.close();

window.showModalDialog(url, ..);

}

But this has a problem. On opening and closing modalDialogs by refreshing the screen multiple times, the browser just crashes. I found that this happens because IE does not release the memory of the modal dialog even on closing it until the method which opened it is complete. In other words, the opening and closing of modal windows needed to be completely disjointed.

To make the opening and closing of modal dialogs disjointed, I used events triggered by a timer 🙂 . For e.g.
var openModalInterval = setInterval(“fnOpenModal()”,1000);

Now, fnOpenModal will open a new modal dialog based on a global JS variable. like this.

function fnOpenModal(){

if(openmodal == true) {

window.showModal(url…);

}

}

This worked and IE releases the memory of the closed modal dialog since the events are disjointed 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: