Skip to content

Instantly share code, notes, and snippets.

@Armster15
Created May 11, 2026 07:02
Show Gist options
  • Select an option

  • Save Armster15/1742bd6bd93535b073f5c961aa8eda21 to your computer and use it in GitHub Desktop.

Select an option

Save Armster15/1742bd6bd93535b073f5c961aa8eda21 to your computer and use it in GitHub Desktop.
Prevent `visibilitychange` from emitting in your browser
// ==UserScript==
// @name No visibilitychange
// @namespace http://tampermonkey.net/
// @version 2024-06-20
// @description Prevent `visibilitychange` from emitting in your browser
// @author You
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// https://stackoverflow.com/a/46986927/5721784
window.addEventListener("visibilitychange", function(event) {
event.stopImmediatePropagation();
}, true);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment