Every once in a while I click a link and see the following (I'm using FF 11.0):

enter image description here

I was wondering why FF does this on some redirects/links and not on others. I was thinking maybe it does that when you're on a page that contains a <form> element?

Thanks for any help here/

1 Answer 1


It's done with JavaScript, using the window.onbeforeunload event (Mozilla, IE).

Some browsers will even let you specify (part of) the text in the dialog box by returning a string from the event handler, but for security reasons, recent versions of Firefox (which you appear to be using) will ignore the string and just always present the same fixed message.

Here's some example code from the MDN page:

window.onbeforeunload = function (e) {
  e = e || window.event;

  // For IE and Firefox prior to version 4
  if (e) {
    e.returnValue = 'Any string';

  // For Safari
  return 'Any string';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.