Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

bookmarks.get()

Given the ID of a bookmarks.BookmarkTreeNode or an array of such IDs, the bookmarks.get() method retrieves the matching nodes and delivers them to a specified callback function.

Syntax

chrome.bookmarks.get(
  idOrIdList,                // string or string array
  function(                  // function
    results                    // array
  ) {...}
)

This API is also available as browser.bookmarks.get() in a version that returns a promise.

Parameters

idOrIdList
string A string or array of strings specifying the IDs of one or more BookmarkTreeNode objects to retrieve.
callback
A function to be called once the nodes have been retrieved. The function is passed the following parameters:
results
A array of matching nodes, in which each entry is a bookmarks.BookmarkTreeNode. Separators are not included in the results. If no nodes could be found, results is undefined and runtime.lastError is set.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 45.0 No 33

Examples

This example checks to see if a bookmark with a particular ID exists:

function onGot(bookmarkItems) {
  if (bookmarkItems) {
    console.log("bookmark exists!");
  } else {
    console.log("bookmark does not exist!");
    console.log("lasterror: " + chrome.runtime.lastError);
  }
}

function doesBookmarkExist(bookmarkId) {
  chrome.bookmarks.get(bookmarkId, onGot);
}

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, wbamberg, Sheppy
 Last updated by: Makyen,