Skip to navigation

Close page

View as Markdown

Close a page in an active browser Runtime. Closing a page removes it from the Runtime; use Open page to create a new one.

Close a page

const closed = await bctrl.tools.call("browser.pages.close", {
pageId,
}, { runtimeId: runtime.id });
console.log(closed.id, closed.url);

The Runtime must be active. If you close the active page, choose another page with Activate page before sending the next page-specific action.

Request parameters

ParameterTypeRequiredDescription
pageIdPageIdYesPage to close.

Response

The response contains the last known page state:

FieldTypeAlways presentDescription
idPageIdYesIdentifier of the closed page.
urlstringYesLast known page URL.
titlestringYesLast known page title.
activebooleanYesWhether the page was active before it was closed.

Run asynchronously

const call = await bctrl.tools.start("browser.pages.close", {
pageId,
}, { runtimeId: runtime.id });
const closed = await bctrl.toolCalls.result(call.id, {
waitSeconds: 30,
});

Next