DocsTab Managementbrowser_set_popup_policy

browser_set_popup_policy

browser_set_popup_policy

Configure how popup windows are handled when JavaScript calls window.open() or links have target='_blank'. Options: 'allow' opens new window, 'block' prevents popup entirely, 'new_tab' opens in foreground tab, 'background' opens in background tab. Default behavior may vary by browser.

When to use browser_set_popup_policy

Use browser_set_popup_policy when you need to manage tabs, popups, and windows within a context. It is part of Owl Browser's Tab Management toolset and runs inside a self-hosted, source-level stealth engine, so every call inherits the same undetectable browser fingerprint as the rest of your automation — no separate anti-detect setup required.

Usage Example

123456789101112
import asyncio
from owl_browser import OwlBrowser, RemoteConfig
# Async usage
async with OwlBrowser(config) as browser:
context = await browser.create_context()
context_id = context["context_id"]
await browser.set_popup_policy(
context_id=context_id,
policy="allow"
)

Parameters

Required

context_idstringrequired

The unique identifier of the browser context (e.g., 'ctx_000001')

policyenum
allowblocknew_tabbackground
required

How to handle popup windows opened by window.open() or target='_blank' links: 'allow' opens in new window, 'block' prevents popup, 'new_tab' opens in foreground tab, 'background' opens in background tab

Response

Returns a JSON object with the operation result.

{
  "success": true,
  "result": <value>
}

Frequently Asked Questions

What does browser_set_popup_policy do?

Configure how popup windows are handled when JavaScript calls window.open() or links have target='_blank'. Options: 'allow' opens new window, 'block' prevents popup entirely, 'new_tab' opens in foreground tab, 'background' opens in background tab. Default behavior may vary by browser. It belongs to Owl Browser's Tab Management category and is available through the REST API, the Python SDK (browser.set_popup_policy()), the Node.js SDK, and the MCP server.

What parameters does browser_set_popup_policy accept?

browser_set_popup_policy accepts 2 required parameters (context_id, policy) and 0 optional parameters. All parameters are sent as JSON in a POST request to /api/execute/browser_set_popup_policy.

Is browser_set_popup_policy detectable by anti-bot systems like Cloudflare or DataDome?

No. browser_set_popup_policy executes inside Owl Browser's Chromium engine, which applies fingerprint spoofing at the C++ source level rather than through JavaScript patches. Every tool call shares the same consistent, human-like fingerprint, so anti-bot systems such as Cloudflare, DataDome, and Akamai see an ordinary browser.

Related Tools

Browse the full Owl Browser API reference or get started with the Python SDK and Node.js SDK.