question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is `dom.disable_beforeunload` still necessary?

See original GitHub issue

I got bit by this on a form I was building and testing on several browser for the typical user warning like “Hey the form is not complete yet do you want to close the page?”.
On a profile with arkenfox the warning is not triggered and the page is closed with form data lost.

I think the abuse of warning spam is something that got fixed (I believe?) by browsers some time ago by hardening the requirements to enable the beforeunload event.

AFAICS last time this was touched was 5 years ago, is this still a concern?
Should there be a warning in the user.js comments informing of potential sideffects of the switch?

https://github.com/arkenfox/user.js/blob/f4187632faef76df4de0cbb0cdc7199f22fadd76/user.js#L611-L614

Thank you!

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rusty-snakecommented, Nov 4, 2022

If sites abuse it, you can disable it on a per site basis using uB’s +js.

One override less. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window: beforeunload event - Web APIs | MDN
The beforeunload event is fired when the window, the document and its resources are about to be unloaded. The document is still visible...
Read more >
How to disable Warning by "onbeforeunload" when "reload ...
My code works well, but I do not need this "beforeunload warning" when reloadind same page (reload button ou F5 key) , or...
Read more >
Sure you want to leave?—browser beforeunload event
In the video, I explain a bit about the beforeunload event—which lets you prompt or warn your user that they're about to leave...
Read more >
How to disable beforeunload events (e.g. "Are you sure you ...
In Firefox you can completely disable beforeunload events by setting dom.disable_beforeunload to true in about:config .
Read more >
Disable navigating away from web page while an upload is in ...
I like the idea. Since we only want the prompt when a file transfer is in progress, we should somehow activate the beforeunload...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found