Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

Window.onbeforeunload is working only when it is has return value

  • 1 baphendule
  • 6 zinale nkinga
  • 2 views
  • Igcine ukuphendulwa ngu guigs

more options

Problem statement is want to execute piece of code only on browser close , refreshing the browser tab , tab close .

Previous version of firefox used to execute the code in window.onbeforeunload in all the 3 events mentioned above but now code in window.onbeforeunload is not executing on refresh click and browser close .

based on the discussion with previous ticket i kept return statement in this block . Now i am able to see the confirmation box . But now i want to execute the code only when we click on Leave this page.can you please help on this . Thanks alot.

One more observation is if i keep the code in window.onunload code is not executing in the tab close and browser close but it is executing in the on refresh .

Problem statement is want to execute piece of code only on browser close , refreshing the browser tab , tab close . Previous version of firefox used to execute the code in window.onbeforeunload in all the 3 events mentioned above but now code in window.onbeforeunload is not executing on refresh click and browser close . based on the discussion with previous ticket i kept return statement in this block . Now i am able to see the confirmation box . But now i want to execute the code only when we click on Leave this page.can you please help on this . Thanks alot. One more observation is if i keep the code in window.onunload code is not executing in the tab close and browser close but it is executing in the on refresh .

Okulungisiwe ngu BalajiPolisetty7

Isisombululo esikhethiwe

Hi, I admire your persistence on this question however there is a bug that has the attachment that Gingerbread man referred to titled: "Bug 391834 - Don't allow alert/confirm/prompt in onbeforeunload, onunload and onpagehide"

This sounds like its disabled and you are trying to make it work. But you also already solved this with a batch file in this question https://support.mozilla.org/en-US/que.../993972?esab=a&s=&r=0&as=s So I will mark this as resolved.

Funda le mpendulo ngokuhambisana nalesi sihloko 👍 0

All Replies (1)

more options

Isisombululo Esikhethiwe

Hi, I admire your persistence on this question however there is a bug that has the attachment that Gingerbread man referred to titled: "Bug 391834 - Don't allow alert/confirm/prompt in onbeforeunload, onunload and onpagehide"

This sounds like its disabled and you are trying to make it work. But you also already solved this with a batch file in this question https://support.mozilla.org/en-US/que.../993972?esab=a&s=&r=0&as=s So I will mark this as resolved.