On Mar 11, 2011, at 7:41 AM, Bertilo Wennergren wrote:
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,
why it might be wise not to leave the page. In Firefox 4 this is no
possible! The dialog will have the following canned text that you
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,
can't add anything to it. If the reason for using "beforeunload"
have anything to do with entered data, or if you'd like to inform
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.
Thanks, this is very interesting. I just tested with the following bit
if (confirm('Are you sure you want to close the window?')) return
In Safari, I got what I expected -- my confirm dialog blocking the
window close. But in Firefox 3.latest, I got two dialogs. First was my
confirm, but when I okayed that I got the second, which was more or
less exactly the same as what you describe for FF4. I commented out
the confirm line, and got only the one alert, but then in Safari I got
no warning at all.
I wonder if there's any way besides browser sniffing to work around
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