您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Prevents websites from detecting tab switches by overriding visibility and focus events.
当前为
- // ==UserScript==
- // @name Bypass Tab Switch Detection
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description Prevents websites from detecting tab switches by overriding visibility and focus events.
- // @author Devrill
- // @match *://*/*
- // @icon https://i.imgur.com/721TjOG.png
- // @license MIT
- // @locale en
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Override document.hidden and document.visibilityState
- Object.defineProperty(document, 'hidden', {
- get: function() {
- return false;
- }
- });
- Object.defineProperty(document, 'visibilityState', {
- get: function() {
- return 'visible';
- }
- });
- // Stop blur and focus events from being triggered
- window.addEventListener('blur', function(e) {
- e.stopImmediatePropagation();
- }, true);
- window.addEventListener('focus', function(e) {
- e.stopImmediatePropagation();
- }, true);
- console.log('Tab switch detection bypassed!');
- })();