Skip to content

Adilnasceng/anti-tab-detect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anti-Tab-Detect

Anti-Tab-Detect Logo

Chrome extension that completely prevents websites from detecting tab switches, page leaves, or window focus changes.

Manifest V3 Chrome Extension MIT License


What is it?

Some websites use various JavaScript APIs to detect whether the user has switched tabs, left the page, or moved the browser window out of focus. Anti-Tab-Detect blocks all known detection methods and makes websites believe the user is always active on the page.

Blocked Detection Methods

# Method Description
1 Page Visibility API document.visibilityState"visible", document.hiddenfalse
2 Event Listeners visibilitychange, blur, focus, focusin, focusout, pagehide, pageshow, mouseenter, mouseleave, mouseover, mouseout
3 Inline Handlers window.onblur, window.onfocus, document.onvisibilitychange etc. setters are disabled
4 document.hasFocus() Always returns true
5 rAF + Time Consistency requestAnimationFrame, performance.now(), Date.now() — consistent fake timeline
6 IntersectionObserver Always reports isIntersecting: true, intersectionRatio: 1
7 Web Audio API AudioContext.state"running", statechange event silenced
8 Idle Detection API IdleDetector.userState"active", screenState"unlocked"

Installation

  1. Clone or download this repository:
    git clone https://github.com/Adilnasceng/anti-tab-detect.git
  2. Open chrome://extensions in Chrome
  3. Enable Developer mode (top right)
  4. Click "Load unpacked"
  5. Select the anti-tab-detect folder

Usage

  • The extension is enabled by default when installed
  • Click the extension icon in the toolbar to open the popup
  • Use the toggle button to enable/disable
  • Icon turns green when active, red when disabled
  • State changes apply to newly opened tabs

Active → Blocking all detection methods
Inactive → Websites can detect normally

Testing

You can verify the extension is working using this online test tool:

https://webbrowsertools.com/test-always-active/

This site tests multiple tab detection methods. With the extension enabled, all tests should report that the tab is always active.

You can also verify manually via DevTools Console (F12):

document.visibilityState   // → "visible"
document.hidden            // → false
document.hasFocus()        // → true

You should see a [Anti-Tab-Detect] Aktif log in the console.

File Structure

anti-tab-detect/
├── manifest.json       # Manifest V3 configuration
├── content.js          # Main override script (MAIN world)
├── background.js       # Service worker — dynamic script registration & icon management
├── popup.html          # Popup UI
├── popup.js            # Toggle control
├── icons/
│   ├── icon-on-16.png  # Active icon (green) — 16x16
│   ├── icon-on-48.png  # Active icon (green) — 48x48
│   ├── icon-on-128.png # Active icon (green) — 128x128
│   ├── icon-off-16.png # Inactive icon (red) — 16x16
│   ├── icon-off-48.png # Inactive icon (red) — 48x48
│   └── icon-off-128.png# Inactive icon (red) — 128x128
├── LICENSE
└── README.md

Technical Details

  • Manifest V3 format, compliant with modern Chrome standards
  • Dynamic content script registration via chrome.scripting.registerContentScripts — controllable with toggle
  • Content script runs in "world": "MAIN" (page's JS context, not isolated)
  • "run_at": "document_start" ensures it loads before the page's own JavaScript
  • Overrides EventTarget.prototype.addEventListener to work across all elements
  • performance.now(), Date.now(), and requestAnimationFrame timestamps are cross-consistent — defeats advanced timing analysis
  • Active/inactive state persisted via chrome.storage.local

MIT License © 2026 Adil NAS

GitHub Sponsor

About

Chrome extension (Manifest V3) that prevents websites from detecting tab switches, page visibility changes, and user inactivity — blocks Page Visibility API, blur/focus events, hasFocus(), rAF timing, IntersectionObserver, Web Audio API, and Idle Detection API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages