Skip to Content
Fingerprint ProtectionActive Window Emulation

Active Window Emulation

Keep the active page in each context focused while the application is unfocused. Use a profile that supports active-window protection.


Prerequisites

  • BotBrowser PRO license or higher.
  • A profile file (.enc for production).

Quick Start

Active window emulation is opt-in. Pass the PRO launch flag with a supported profile. A profile that does not support active-window protection keeps the option inactive.

chromium-browser \ --headless \ --bot-profile="path/to/profile.enc" \ --proxy-server=socks5://user:[email protected]:1080 \ --bot-always-active

To explicitly control it:

# Enable explicitly on PRO chromium-browser \ --bot-profile="path/to/profile.enc" \ --bot-always-active # Disable for testing purposes chromium-browser \ --bot-profile="path/to/profile.enc" \ --bot-always-active=false

How It Works

Browser window focus and visibility state can be used as a privacy signal to distinguish automated sessions from real user activity.

When active-window protection is enabled, BotBrowser keeps the active page in focus while another browser context or application receives focus. The foreground tab in each context remains active. Switching among tabs inside the same context still produces normal blur and visibility transitions.

This protection works in both headless and headful modes.


Common Scenarios

Production deployment

In production, enable active window emulation explicitly when the workflow needs it:

const browser = await chromium.launch({ executablePath: BOTBROWSER_EXEC_PATH, headless: true, args: [ `--bot-profile=${BOT_PROFILE_PATH}`, "--proxy-server=socks5://user:[email protected]:1080", ], }); const page = await browser.newPage(); // document.hidden will always be false const hidden = await page.evaluate(() => document.hidden); console.log("hidden:", hidden); // false await page.goto("https://example.com"); await browser.close();

Multi-tab with consistent active state

When opening multiple tabs, the active tab in each context stays active. Inactive tabs in the same context follow normal visibility behavior:

const page1 = await browser.newPage(); const page2 = await browser.newPage(); // The newly created active tab becomes visible; the previous tab becomes hidden const hidden1 = await page1.evaluate(() => document.hidden); const hidden2 = await page2.evaluate(() => document.hidden); console.log(hidden1, hidden2); // typically true, false

Disabling for debugging

If you need to test focus-dependent behavior in your application, disable the emulation:

chromium-browser \ --bot-profile="path/to/profile.enc" \ --bot-always-active=false

Troubleshooting / FAQ

ProblemSolution
Page detects background state despite emulationVerify your license is PRO or above. The flag is not available on lower tiers.
Need to test real focus/blur eventsDisable with --bot-always-active=false. Remember that this changes the browser’s behavior for tracking-sensitive pages.
visibilitychange listener never firesConfirm that the page uses a supported profile and passes --bot-always-active. Tab changes within one context still produce normal visibility transitions.

Next Steps


Related documentation: Advanced Features: Active Window Emulation


Legal Disclaimer & Terms of Use • Responsible Use Guidelines. BotBrowser is for authorized fingerprint protection and privacy research only.


Related BotBrowser blog: What Is Browser Fingerprinting

Updated