Scriptlets icon indicating copy to clipboard operation
Scriptlets copied to clipboard

Add new scriptlet — 'disable-pageview-api'

Open BlazDT opened this issue 8 months ago • 0 comments

YouTube uses pageview api to show popup "Video paused. Continue watching?" when user is not interacting with the page.

/// disable-pageview-api.js (function(){ // based on https://addons.mozilla.org/en-US/firefox/addon/disable-page-visibility/ // visibilitychange events are captured and stopped document.addEventListener("visibilitychange", function(e) { e.stopImmediatePropagation(); }, true); // document.visibilityState always returns false Object.defineProperty(Document.prototype, "hidden", { get: function hidden() { return false; }, enumerable: true, configurable: true }); // document.visibilityState always returns "visible" Object.defineProperty(Document.prototype, "visibilityState", { get: function visibilityState() { return "visible"; }, enumerable: true, configurable: true }); })()

Discussion on reddit regarding it: https://www.reddit.com/r/firefox/comments/f0ewaq/any_way_to_disable_pageview_api_via_unlock_origin/

BlazDT avatar Jun 19 '25 05:06 BlazDT