https://github.com/daijro/always-on-focus
Prevent websites from knowing that you switched tabs
https://github.com/daijro/always-on-focus
greasemonkey tampermonkey userscript
Last synced: 11 months ago
JSON representation
Prevent websites from knowing that you switched tabs
- Host: GitHub
- URL: https://github.com/daijro/always-on-focus
- Owner: daijro
- Created: 2020-11-10T00:55:43.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-06-09T06:41:25.000Z (about 2 years ago)
- Last Synced: 2025-04-06T06:53:52.583Z (about 1 year ago)
- Topics: greasemonkey, tampermonkey, userscript
- Language: JavaScript
- Homepage: https://greasyfork.org/en/scripts/429635
- Size: 508 KB
- Stars: 42
- Watchers: 2
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Always on focus
Userscript to trick websites into thinking the tab is always on focus
---
## Installation
1. Download the [Tampermonkey](https://www.tampermonkey.net/) browser extension
2. Click [here](https://github.com/daijro/always-on-focus/raw/main/alwaysonfocus.user.js) to install the userscript
3. Toggle the userscript on/off from the Tampermonkey dashboard
## What it does
Always on focus is a lightweight userscript that prevents websites from knowing that you switched tabs or unfocused the window. This is a fork of [this userscript](https://userscripts-mirror.org/scripts/review/177284) that adds these:
- Disables the [Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API)
- Disables the `window.onblur()` event and and sets `window.hasFocus()` and `window.onFocus()` to always true ([Ex.](https://www.codingwithjesse.com/demo/2007-05-16-detect-browser-window-focus/))
- Removes the `visibilitychange` and `blur` event listeners ([Ex.](http://daniemon.com/tech/webapps/page-visibility/))
#### Example:
Here is an example website that changes color when the window isn't focused:
