posted 23 years ago
manav solution is nice, but even without the toolbars someone can hit the "X" in the corner and close the window. I would go with manav solution at first until you can figure something else out. I never had to try and do this, and I would have went with onUnload also.
What you may be able to do is have a javascript call in the main window that runs the code. Then you can set a flag on the main page with "false" and if they fill out the form, change the flag to "true". Then when they close the window, have an onUnload call that runs the function on the main page, if it is false then open up the dialog box. If they hit "yes" (being they do want to fill out the form) then just open the window back up.
To make it look better I would use the IE call onbeforeUnload and then have and onLoad call also like above. Just before you run it, check to see what browser they are running and don't run the function for IE users, since you were able to run it for IE on the onbeforeUnload call. Not the prettiest solution but still does what you want it to do.
Other than that, I can't think of any function in Netscape like the IE function.
One more note, as to manav reference that self.close() will cause an alert box, that is only true if you are trying to close the parent window, not a child window. Child window's can be closed anytime, by the parent or the child.
Hope that helps,
Bill