Lots of pages have alerts when you leave them: if you close tabs, navigate away without saving, etc, there are numerous reasons why a site would alert/block you from leaving until you confirm an alert, e.g. "Are you sure you want to navigate away from this page?".
This is typically done with the
Here is an example.
Is there any way that I can prevent alerts/user-blocking events generated by those handlers? Basically, I'd like to leave JS enabled, and specifically disallow things that would prevent me from leaving a page without an extra click from happening.
onunload handlers should still fire; they just shouldn't be allowed to do things that block the user. That means no alerts, and no operations that take more than a few seconds.
What I've Tried: