Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/bookmarks/getchildren/index.md
6581 views
------{{AddonSidebar()}}
bookmarks.getChildren() retrieves all the immediate children of a given bookmark folder, identified as a {{WebExtAPIRef("bookmarks.BookmarkTreeNode", "BookmarkTreeNode")}} ID.
This is an asynchronous function that returns a Promise.
Syntax
Parameters
id: A {{jsxref("string")}} which specifies the ID of the folder whose children are to be retrieved.
Return value
A Promise that will be fulfilled with an array of BookmarkTreeNode objects. Each entry represents a single child node. The list is ordered in the same order in which the bookmarks appear in the user interface. Separators are currently not 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
{{WebExtExamples}}
Browser compatibility
{{Compat}}
Note: This API is based on Chromium's
chrome.bookmarksAPI. This documentation is derived frombookmarks.jsonin the Chromium code.