Forced Visibility

Try to prevent websites from detecting tab focus without breaking functionality

// ==UserScript==
// @name        Forced Visibility
// @author      d3ad connection
// @match       https://*/*
// @match       http://*/*
// @include     *
// @description Try to prevent websites from detecting tab focus without breaking functionality
// @version 0.0.1.20250925025908
// @namespace https://gf.qytechs.cn/users/1519047
// ==/UserScript==


(function() {
    'use strict';
    try { Object.defineProperty(document, 'hidden', { configurable: true, get: () => false }); } catch(e) {}
    try { Object.defineProperty(document, 'visibilityState', { configurable: true, get: () => 'visible' }); } catch(e) {}
    try { document.hasFocus = () => true; } catch(e) {}
    window.addEventListener('visibilitychange', e => e.stopImmediatePropagation(), true);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址