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

1const closed = await bctrl.tools.call("browser.pages.close", {
2 pageId,
3}, { runtimeId: runtime.id });
4
5console.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

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

Next