views:

64

answers:

2

I'm having an unexpected "annoying" popup in IE7 (and possibly other versions). As expected IE prompts you about unsaved form data when closing the window which is fine. But I have a form inside a div and now when I toggle the display CSS style between none and block, IE thinks I'm closing the form with unsaved data and shows the warning about closing an unsaved form! I don't want my users to be annoyed when simply hiding a form in my IE-based web app.

Anyone know how to overcome this?

A: 

Make sure that your doc type is transitional rather than strict

Sarfraz
Unfortunately didn't get rid of the prompt. Silly IE!
Nick Bedford
A: 

The prompt isn't IE's-- your HTML has an onbeforeunload handler which triggers the warning.

EricLaw -MSFT-
It does? Or should I have one?
Nick Bedford
IE itself doesn't show a prompt when you close it unless your HTML contains an OnBeforeUnload handler.
EricLaw -MSFT-