Bypass Tab Switch Detection

Prevents websites from detecting tab switches by overriding visibility and focus events.

  1. // ==UserScript==
  2. // @name Bypass Tab Switch Detection
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Prevents websites from detecting tab switches by overriding visibility and focus events.
  6. // @author Devrill
  7. // @match *://*/*
  8. // @icon https://i.imgur.com/xePbmM7.png
  9. // @license MIT
  10. // @locale en
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14.  
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. // Override document.hidden and document.visibilityState
  20. Object.defineProperty(document, 'hidden', {
  21. get: function() {
  22. return false;
  23. }
  24. });
  25.  
  26. Object.defineProperty(document, 'visibilityState', {
  27. get: function() {
  28. return 'visible';
  29. }
  30. });
  31.  
  32. // Stop blur and focus events from being triggered
  33. window.addEventListener('blur', function(e) {
  34. e.stopImmediatePropagation();
  35. }, true);
  36.  
  37. window.addEventListener('focus', function(e) {
  38. e.stopImmediatePropagation();
  39. }, true);
  40.  
  41. console.log('Tab switch detection bypassed!');
  42. })();

QingJ © 2025

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