Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to disable onbeforeunload in Firefox browser. Don't tell me to disable JavaScript. I just want to disable this dialog box from appearing.

share|improve this question

migrated from Jul 10 '11 at 3:41

This question came from our site for professional and enthusiast programmers.

up vote -1 down vote accepted

one thing i do when some annoying website run some stuff like that is overriding the functions. let me give you an example.

in most cases if onbeforeunload has been defined using this method:

window.onbeforeunload = function() {

You can override it using firebug console the same way

window.onbeforeunload = function() {} // blank function

Note: I have encountered some script that use self.close with a timer that is also very annoying for a slow reader like me. here is my solution

window.close = function() {} // blank function

simply override closing the window.

I hope this answers your question

share|improve this answer
I want this feature to be disabled every page i visit – MonsterMMORPG Jul 10 '11 at 16:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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