> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browspark.krishm.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Downloads, PDFs and domain policies

> Collect files the browser downloads, print pages to PDF, and fence where tabs may go.

## Downloads

`browser_download {action: "list"}` reports downloads observed while the debugger is attached to a shared tab. Extension mode uses tab-specific browser events, so another tab's downloads stay private even on the same website. It reports the suggested filename and progress; the local file path is unavailable in this mode. Developer mode reports files in the context's download directory (`~/.browspark/downloads/<context>` unless overridden at launch), including their paths.

`{action: "wait", urlContains, timeoutMs}` returns a matching completed download immediately, or waits for one to complete. Use it right after clicking an "Export CSV" button; a file path is included when available.

## PDF

`browser_pdf` prints the current page like Print → Save as PDF: `format` (`A4`, `Letter`, `Legal`), `landscape`, `printBackground`, `scale`, and `path` to write somewhere other than the artifacts directory. Returns the file path.

## Domain policies

`browser_policy` restricts where a tab may navigate and load resources from. `allow` is an allow-list (everything else is blocked); `block` is a deny-list. Subdomains match, non-HTTP schemes always pass, and blocked navigations fail with `ERR_BLOCKED_BY_CLIENT`.

```json theme={null}
{ "action": "set", "tabId": 1234, "allow": ["example.com", "cdn.example.net"] }
```

With `default: true` the policy applies to every tab the agent opens from now on, which is the way to keep a scraping run on the sites you intend:

```json theme={null}
{ "action": "set", "default": true, "block": ["doubleclick.net", "google-analytics.com"] }
```

`status` shows the active policy; `clear` removes it. Policies are enforced through Chrome's Fetch domain so they cover subresources, not just top-level navigation.
