MDN self-hosted library · e01.org

bookmarks.getChildren()

bookmarks.getChildren() retrieves all the immediate children of a bookmark folder, identified as a BookmarkTreeNode ID.

Open notebook · 1 cells webextension-api-function upstream source

bookmarks.getChildren() retrieves all the immediate children of a bookmark folder, identified as a BookmarkTreeNode ID.

This is an asynchronous function that returns a Promise.

Syntax

let gettingChildren = browser.bookmarks.getChildren(
  id                     // string
)

Parameters

  • id
  • : A String that specifies the ID of the folder whose children are to be retrieved.

Return value

A Promise that is fulfilled with an array of BookmarkTreeNode objects. Each entry represents a child node. The list is in the same order as the bookmarks appear in the user interface. Separators are included in the results. The list includes subfolders but does not include any children contained in subfolders.

If the specified node has no children, the array is empty.

If the node identified by id is not found, the promise is rejected with an error message.

Examples

function onFulfilled(children) {
  for (child of children) {
    console.log(child.id);
  }
}

function onRejected(error) {
  console.log(`An error: ${error}`);
}

let gettingChildren = browser.bookmarks.getChildren("unfiled_____");
gettingChildren.then(onFulfilled, onRejected);

Browser compatibility

[!NOTE] This API is based on Chromium's chrome.bookmarks API. This documentation is derived from bookmarks.json in the Chromium code.