bookmarks.get()

Given the ID of a bookmarks.BookmarkTreeNode or an array of such IDs, the bookmarks.get() method retrieves the matching nodes.

This is an asynchronous function that returns a Promise.

Syntax

js
let getBookmarks = browser.bookmarks.get(
  idOrIdList                // string or string array
)

Parameters

idOrIdList

A string or array of strings specifying the IDs of one or more BookmarkTreeNode objects to retrieve.

Return value

A Promise that will be fulfilled with an array of BookmarkTreeNode, one for each matching node. Separators are not included in the results. If no nodes could be found, the promise will be rejected with an error message.

Examples

This example tries to get the bookmark whose ID is bookmarkAAAA. If no bookmark with this ID exists, onRejected is called:

js
function onFulfilled(bookmarks) {
  console.log(bookmarks);
}

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

let gettingBookmarks = browser.bookmarks.get("bookmarkAAAA");
gettingBookmarks.then(onFulfilled, onRejected);

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
get
Chrome – Full support
Chrome 3 (Release date: 2009-09-15)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Note: This API is based on Chromium's chrome.bookmarks API. This documentation is derived from bookmarks.json in the Chromium code.