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

bookmarks.getRecent()

The bookmarks.getRecent() method retrieves a specified number of the most recently added bookmarks as an array of BookmarkTreeNode objects.

Syntax

chrome.bookmarks.getRecent(
  numberOfItems,          // integer
  function(               // function
    results                 // array of BookmarkTreeNode objects
  ) {...}
)

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

Parameters

numberOfItems
A number representing the maximum number of items to return. The returned list will contain up to this many of the most recently added items.
callback
A function to be called when the list has been retrieved; it is passed the following parameters:
results
An array of bookmarks.BookmarkTreeNode objects, each describing one bookmark node.

Browser compatibility

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

Examples

This example logs the URL for the most recently added bookmark:

function gotMostRecent(bookmarkItems) {
  if (bookmarkItems.length) {
    console.log(bookmarkItems[0].url);
  }
}

chrome.bookmarks.getRecent(1, gotMostRecent);

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,