interceptor_browser_inject_init_script
Inject a JavaScript file that runs before every page script on each navigation, enabling early modification of the browser environment for automation or testing.
Instructions
Inject a JS file as an init script (Playwright page.addInitScript). Runs before any page script on every subsequent navigation/frame. Cloakbrowser (Chromium): runs in the isolated utility world — no DOM artifact; patches to shared prototypes/globals reach the page main world via utility-world sharing. Camoufox (cloverlabs/FF150): runs directly in the page's main world. Patches (e.g. Object.defineProperty(navigator, 'webdriver', ...)) DO apply to the page, but are observable by anti-bot code on the page (Function.prototype.toString leak applies). For Camoufox stealth, prefer source-level fingerprint config at launch (os, webgl_config, fonts, humanize, …) over JS injection. Earlier daijro/FF135 ran init scripts in a Juggler scope that did NOT reach the page (camoufox#48); cloverlabs/FF150 removed that scope. Does NOT affect the currently loaded document — navigate again to apply.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_id | Yes | Target ID from interceptor_browser_launch or interceptor_camoufox_launch | |
| script_path | Yes | Absolute path to a .js file to inject before page scripts on every load. |