diff --git a/auth/profiles.mdx b/auth/profiles.mdx index a58277f..2e44aaf 100644 --- a/auth/profiles.mdx +++ b/auth/profiles.mdx @@ -112,6 +112,28 @@ print("Live view:", kernel_browser2.browser_live_view_url) ``` +## Override opening existing tabs in a new session + +By default, Profiles restore existing tabs saved in the profile. Pass `start_url` with the profile to clear those restored tabs and open a specific page when the new browser starts. + + +```typescript Typescript/Javascript +const browser = await kernel.browsers.create({ + profile: { name: 'profiles-demo' }, + start_url: 'https://example.com/dashboard', +}); +``` + +```python Python +browser = await kernel.browsers.create( + profile={"name": "profiles-demo"}, + start_url="https://example.com/dashboard", +) +``` + + +The same behavior applies to browser pools configured with both a profile and start url. + ## Loading a profile into an existing browser You can load a profile into a browser after it has been created using the [update browser endpoint](https://kernel.sh/docs/api-reference/browsers/update-browser-session). diff --git a/browsers/pools/overview.mdx b/browsers/pools/overview.mdx index 557b1f2..bec0d85 100644 --- a/browsers/pools/overview.mdx +++ b/browsers/pools/overview.mdx @@ -52,6 +52,7 @@ const pool = await kernel.browserPools.create({ stealth: true, headless: false, timeout_seconds: 600, + start_url: "https://example.com", viewport: { width: 1280, height: 800 @@ -72,6 +73,7 @@ pool = kernel.browser_pools.create( stealth=True, headless=False, timeout_seconds=600, + start_url="https://example.com", viewport={ "width": 1280, "height": 800 @@ -84,7 +86,7 @@ print(pool.id) ### Pool configuration options -Pools can be pre-configured with options like custom extensions, supported viewports, residential proxies, profiles, and more. See the [API reference](https://kernel.sh/docs/api-reference/browser-pools/create-a-browser-pool) for more details. +Pools can be pre-configured with options like start url, custom extensions, supported viewports, residential proxies, profiles, and more. See the [API reference](https://kernel.sh/docs/api-reference/browser-pools/create-a-browser-pool) for more details. ## Acquire a browser diff --git a/reference/cli/browsers.mdx b/reference/cli/browsers.mdx index 66b8a4a..0b7586e 100644 --- a/reference/cli/browsers.mdx +++ b/reference/cli/browsers.mdx @@ -21,6 +21,7 @@ Create a new browser session. | `--stealth` | Enable stealth mode to reduce automation fingerprints. | | `--headless` | Launch without GUI/VNC access. | | `--kiosk` | Launch in Chrome kiosk mode. | +| `--start-url ` | Initial page to open on launch. | | `--output json`, `-o json` | Output raw JSON object. | ### `kernel browsers delete ` @@ -432,6 +433,7 @@ Create a new browser pool. | `--size ` | Number of browsers in the pool (required). | | `--fill-rate ` | Percentage of the pool to fill per minute. | | `--timeout ` | Idle timeout for browsers acquired from the pool. | +| `--start-url ` | Initial page to open for new browsers. | | `--output json`, `-o json` | Output raw JSON object. | ### `kernel browser-pools get ` @@ -447,6 +449,8 @@ Update pool configuration. | Flag | Description | |------|-------------| | `--size ` | Updated pool size. | +| `--start-url ` | Initial page to open for new browsers. | +| `--clear-start-url` | Clear the pool start URL. | | `--discard-all-idle` | Discard all idle browsers and refill. | | `--output json`, `-o json` | Output raw JSON object. |