Link to home
Start Free TrialLog in
Avatar of danburyit
danburyit

asked on

Internet Explorer crashes when using a modal dialog

I have an application that uses several modal dialogs (showModalDialog) for various features in a page editor. I've been experiencing that when you do too many things within a dialog it will crash IE. One dialog, for example, allows you to upload images and set various image attributes. When you click the save button on the dialog the window is dismissed and the image is placed on the web page. However, if you open the dialog and try to upload more than two images it will crash. Other dialogs also have similar issues. If you open a dialog and make only a limited number of changes then dismiss the dialog it works fine. But when you try to do several things at once within the open dialog it will eventually crash.

Is this possibly something wrong with my code in the dialog, or is there some buffer to do with scripting in IE that is getting overloaded, or just a bug in IE that is causing it to crash?
Avatar of RedKelvin
RedKelvin

Do you have any other issues with IE, that would suggest there is something wrong with it? Is it normally unstable when used stand alone.

The first thing you should do is make sure you have all of the Microsoft updates for IE6, there has been many.

If this does not seem to help, try the following.

1. Uninstall IE6
2. Run a registry cleaner to clean up any keys that may have been left behind.
3. reinstall IE.

Other suggestions/thoughts
Is your system running out of resources, are you pushing to it's limit?
Have you defragged recently?
Have you run a virus and adware scan recently?
Avatar of danburyit

ASKER

All of the suggestions in the previous post do sound like good points; however, IE is all up to date on the patches, I have no viruses, plenty of system resources, etc. The crashing behaviour is very consistent on several comuters. As with the image upload, you can upload two images and on the third IE will crash. It seems to be something specific with the dialogs. Is there a limited amount of memory space allocated for client-side javascript code that crashes the browser if used up?? This seems more to be a bug or some issue with IE. Who do you tell?
Could you give me some information about what technologies you are using.
You mentioned specifically that this is happening with a modal dialog, does it happen with modeless dialogs

are you freeing all resources after using them.
I am using IE 6.whateveriscurrent on a Windows XP SP2 box and the problem seems to be occurring as a result of client-side javascript in the modal dialog. I don't know what a modeless would do but I can't imagine it would be much different. I suppose it would be easy enough to try. I expect if the problem didn't occur in a modeless dialog that it must be some issue with modal dialogs which brings me back to "who at Microsoft do you tell about it?"

I suppose I pay more attention to nulling objects in my server side code (I use javascript server-side also) like connection strings and recordsets. However, I do use some objects in the client code, like arrays and objects. I will scan over the code and make sure they are all nulled out after they are used as well and see if that makes any difference.
ASKER CERTIFIED SOLUTION
Avatar of RedKelvin
RedKelvin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, I followed the advice above and found the culprit. Whenever an image is chosen for upload by clicking the 'browse' button and choosing a file, the image is displayed in a preview panel on the modal dialog and resized to fit if necessary. Whenever an image is selected, the clearAttributes() method is called on the image object to remove any height and width values that may have belonged to a previously displayed image. It is the clearAttributes() method that is causing the crash. I take it out and no crashing. I put it back and it crashes on the third or fourth image displayed.

Now I just need to clear those values by some other means so every image displayed in the preview isn't forced to the same size as the first image displayed. Using a removeAttribute() for each of the height and width attributes seems to work only about 90% of the time.

Thanks