Screen and Window Protection
Screen dimensions, window properties, and display characteristics are privacy-relevant surfaces. BotBrowser provides full control over these values to maintain consistent display identity.
Prerequisites
- Familiarity with Browser Fingerprinting Explained.
- BotBrowser installed with a valid profile. See Installation.
Quick Start
chromium-browser \
--bot-profile="path/to/profile.enc"Overview
Screen and window properties vary across devices and monitor configurations. The combination of screen resolution, available dimensions, device pixel ratio, color depth, and window frame sizes creates a device-specific profile that is accessible without any permissions and stable across sessions. BotBrowser provides full control over these values at the browser engine level.
Configuration
Window Dimensions
Control window size with --bot-window:
# Use profile's window settings (default for headless)
--bot-window=profile
# Use real system window dimensions (default for desktop headful)
--bot-window=real
# Direct size specification (innerWidth x innerHeight)
--bot-window=1920x1080
# Full JSON customization
--bot-window='{"innerWidth":1920,"innerHeight":1080,"devicePixelRatio":2}'When using WxH format, outerWidth and outerHeight are auto-derived from the profile’s border definitions to maintain consistent frame dimensions.
Viewport Overrides
The loaded profile owns the page viewport. CDP Emulation.setDeviceMetricsOverride, Playwright setViewportSize, and Puppeteer setViewport do not replace that viewport:
- Mobile profiles ignore the override.
- Desktop profiles ignore an override when both the requested width and height fit inside the reported screen.
- An override that expands beyond the reported screen is allowed for full-page capture.
- Ignored overrides return success and do not raise an error.
Use --bot-window=WxH to select the inner viewport size:
--bot-window=640x480The example produces innerWidth === 640 and innerHeight === 480; outerWidth and outerHeight include the profile’s frame dimensions.
Screen Properties
Control screen dimensions with --bot-screen:
# Use profile's screen settings (default for headless)
--bot-screen=profile
# Use real system screen dimensions (default for desktop headful)
--bot-screen=real
# Direct size specification (width x height)
--bot-screen=2560x1440
# Full JSON customization
--bot-screen='{"width":2560,"height":1440,"availWidth":2560,"availHeight":1400}'Device Scale Factor
Use --bot-dpr to select profile, host, or compatibility display-scale behavior. See Device Pixel Ratio Policy for mode selection and per-context setup.
The separate GUI scaling control does not select a DPR policy:
--bot-disable-device-scale-factor=trueScrollbar Layout
The profile’s target scrollbar metrics determine whether the profile uses overlay or classic scrollbars. A zero width selects overlay scrollbars; a positive width selects classic scrollbars. This keeps CSS layout and element measurements aligned when a profile runs on a host with a different scrollbar style.
When the screen comes from the profile or from an explicit --bot-screen value, a headed window cannot grow beyond that screen. The limit applies to default and requested sizes, maximization, and programmatic resizing. A real screen policy keeps the host display limit, and pinned windows keep their configured geometry.
Orientation changes update the window and screen geometry together. A mobile profile with an explicit orientation keeps the corresponding orientation type and angle after a document reload.
When active-window protection is enabled for a supported profile, moving focus to another application does not deactivate the active page. Each BrowserContext with the same active-window policy remains active when another context receives focus. Switching among tabs inside one context still follows the normal blur and visibility behavior.
Headful Mode Note
Desktop profiles default to real in headful mode, meaning the browser uses actual system window and screen dimensions. To apply profile-defined dimensions in headful mode, set both flags explicitly:
--bot-window=profile
--bot-screen=profilePer-Context Configuration
For Per-Context Fingerprint, pass --bot-window and --bot-screen in botbrowserFlags before the context creates its first page or worker. The selected display policy then remains associated with that BrowserContext across desktop and mobile profile workflows. See Per-Context Fingerprint for the setup order.
How BotBrowser Provides Protection
BotBrowser controls all screen and window properties at the browser engine level. Screen dimensions, available area, window size, device pixel ratio, color depth, and frame dimensions are all defined by the profile. CSS media queries, JavaScript property access, and Client Hints headers return consistent values.
Troubleshooting / FAQ
| Problem | Solution |
|---|---|
| Viewport doesn’t match profile | Profile-backed viewports ignore normal Playwright or Puppeteer viewport overrides without an error. Select the size with --bot-window=WxH. |
| Screen size shows host display in headful mode | Set --bot-screen=profile and --bot-window=profile explicitly for headful. |
| Frame dimensions inconsistent with claimed OS | Verify the profile matches your intended platform. Frame borders are OS-specific. |
| devicePixelRatio shows host value | Load the intended profile and select --bot-dpr=profile. GUI scaling is controlled separately. |
Next Steps
- CSS Signal Consistency. CSS media queries that probe display characteristics.
- Navigator Properties. Browser API surfaces that complement screen data.
- Browser Fingerprinting Explained. The full fingerprinting landscape.
- CLI Flags Reference. All window and screen configuration flags.
Related documentation: Advanced Features: Display & UI Control
Legal Disclaimer & Terms of Use • Responsible Use Guidelines. BotBrowser is for authorized fingerprint protection and privacy research only.
Related BotBrowser blog: Screen and Window Fingerprinting: Display Tracking | Screen and viewport properties for responsive design | Screen Wake Lock lifecycle and privacy