Skip Beforeunload is a browser extension. It stops websites from preventing Chromium-based browsers from closing with “Leave site?” confirmation dialogs.
The project is open source under MIT license, and can be found at Github
⇩ Download
23.09.2026 – Version 1.0.0 – 7kb
The Problem
When i tried to close my browser, then there was always one page blocking the close. Youtube music with its “do you really want to leave page” nagscreen. And so the browser stayed open until i explicitely clicked away this dialog.

The Solution
Skip Beforeunload simply skips this dialog and immediately closes the browser instead. As it should.
Installation (Chrome, Edge, Brave, Vivaldi, Opera — Chromium ≥ 111)
This extension is installed as an unpacked extension (developer mode):
Clone this repository or download it as a zip and extract it.
Open the extensions page: chrome://extensions (Edge: edge://extensions, Opera: opera://extensions).
Chrome and Edge only: enable Developer mode first (top right). Opera offers the option without it.
Click Load unpacked extension and select the skip-beforeunload folder (the one that directly contains manifest.json).
That’s it. No browser restart needed; for tabs that were already open, a single reload (F5) is enough for the script to be injected.

Note: Chromium browsers do not allow installing local .crx files directly (store-only policy), so “load unpacked” is the supported way to use this extension.
How it works
The content script runs with world: “MAIN” and run_at: “document_start” — i.e. in the page’s own JavaScript context and before any page script runs. This needs no service worker and no permissions, only Chromium ≥ 111 (when world: MAIN was introduced).
Important: Chrome shows the leave prompt as soon as any beforeunload/ unload listener exists on the document. The extension therefore registers none of its own and blocks every registration attempt by the page:
EventTarget.prototype.addEventListener/removeEventListener: calls with this === window and type beforeunload/unload are swallowed — catches all call paths (window.addEventListener, bare addEventListener, .call(window, …)).
window.addEventListener/removeEventListener: additionally secured as own properties (e.g. in case a page restores the prototype).
window.onbeforeunload / window.onunload: accessor properties that swallow assignments and return null; configurable: false prevents restoration via Object.defineProperty.
The script is idempotent (flag on window); double injection is harmless.
Limitations
All beforeunload handlers are suppressed — including legitimate “unsaved changes” warnings. Sites that do cleanup or fire beacons in beforeunload no longer get the chance; the correct hook for that is pagehide, which is not touched.
Chrome has been deprecating the unload event since 2026 (bfcache project), but not beforeunload — the dialog mechanism stays, so this extension remains useful.
Chromium only (Firefox/Safari are not covered; MV3 world: MAIN).
Privacy
The extension collects, sends, and stores no data. No tracking, no telemetry, no permissions beyond the declared content script.
The addon is open source under MIT license.
Devlog
23.09.2026 – Version 1.0.0
Initial release.
