← Back to context

Comment by _Algernon_

1 day ago

One of the first settings I change in any new browser is to forbid notification requests from all pages, and disable dom.beforeUnload (stops websites being able to prompt to confirm if I want to close the tab). Those functionalities are probably the most abused browser functionalities and definitely shouldn't be enabled by default (or if so only for a whitelist of sites).

How do you do this? I'm looking to do it for the clipboard API. Browsers should be able to block copy and paste.

  • In firefox: about:config -> dom.disable_beforeunload=true

    For copy-paste: dom.event.clipboardevents.enabled=false I would guess.

  • A quick google shows this for FF (taken from a thread in StackOverflow):

    > In Firefox you can completely disable beforeunload events by setting dom.disable_beforeunload to true in about:config. Extensions may be needed for other browsers.

    A word of caution: I'm not 100% sure, but I wonder if some web collaboration tools might use this to ensure data has been synced with a server.

    • It surely has a lot of legitimate uses, even if it is primarily abused. I’ve used it before to do various cleanup tasks, to have a more timely “user disconnected” event, rather than waiting on some timeout to occur server side.

      Having said that, it should never be the end of the world to disable, sites should never have data loss due to this event missing, because if so, they already have a data loss problem when for instance the power goes out.

      1 reply →