page_init_script
Run custom JavaScript at document start on every navigation, before page scripts load, to intercept API responses, capture state, and patch the environment.
Instructions
INIT SCRIPTS: run your JS at DOCUMENT START on every navigation — BEFORE any page script loads. The deepest interception layer in Ghostfox: hooks installed here are what page libraries (gt.js, analytics, frameworks) capture, so their stored references are YOURS. Use for: API response interception (JSONP callback swaps), state capture, anti-detection instrumentation, environment patches. Applies to subsequent navigations.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_id": "<session_id>",
"page_id": "<page_id>",
"source": "<source>"
},
"name": "page_init_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | JavaScript source to run at document start on every navigation. | |
| page_id | Yes | ||
| session_id | Yes |