Disable Page Visibility API

Disable HTML5 Page Visibility API to prevent website tracking you

  1. // ==UserScript==
  2. // @name Disable Page Visibility API
  3. // @namespace https://www.kookxiang.com/
  4. // @version 0.1
  5. // @description Disable HTML5 Page Visibility API to prevent website tracking you
  6. // @author kookxiang
  7. // @match https://*/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. document.addEventListener('visibilitychange', function (e) { e.stopImmediatePropagation(); }, true);
  13.  
  14. Object.defineProperty(document, 'visibilityState', { get: function () { return "visible"; } });