Skip to content

Instantly share code, notes, and snippets.

View julienreszka's full-sized avatar

Julien Henri Reszka julienreszka

View GitHub Profile
@julienreszka
julienreszka / disable-pageview-api.js
Created August 25, 2020 22:33 — forked from gwarser/disable-pageview-api.js
"Disable Page Visibility API" scriptlet for uBO
/// disable-pageview-api.js
// Based on: https://addons.mozilla.org/firefox/addon/disable-page-visibility/
// License: http://www.opensource.org/licenses/bsd-license.php
(function(){
// visibilitychange events are captured and stopped
document.addEventListener("visibilitychange", function(e) {
e.stopImmediatePropagation();
}, true);
// document.visibilityState always returns false
Object.defineProperty(Document.prototype, "hidden", {