T.J. Crowder <t...@crowdersoftware.com> wrote:
> Yes, you can run functions using the window unload event. Example:
> Open that link in a tab, click "Open Window", then close the tab you
> opened the link in -- the subordinate window closes as well.
> What you can do in those functions is severely limited by modern
> browsers (for all the good reasons you can think of). You can't open
> new windows, do alerts/confirms, I think even synchronous ajax calls
> are off-limits (at least cross-browser). But you can do some useful
> things (like close subordinate windows).
Here's a limitation with "beforeunload" (in case someone hasn't
More of less the only thing you can do with "beforeunload", is to ask
the user if he or she really wants to leave the page. A dialog
will appear, and the user can choose to abort the unloading and stay
on the page. Normally you can add your own text to this dialog, informing
why it might be wise not to leave the page. In Firefox 4 this is no longer
possible! The dialog will have the following canned text that you cannot
change (it might be in another language though):
"This page is asking you to confirm that you want to leave - data you
have entered may not be saved."
That's what the dialog will say in Firefox 4. You can't change it, and you
can't add anything to it. If the reason for using "beforeunload" does not
have anything to do with entered data, or if you'd like to inform the user
precisely what kind of data would be lost, or where on the page it is to be
found, or why it's would be so bad to lose it, you're out of luck.
This is all by design.
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to firstname.lastname@example.org.
To unsubscribe from this group, send email to
For more options, visit this group at