bookmarks.getRecent()

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

This is an asynchronous function that returns a Promise.

Syntax

var gettingRecent = browser.bookmarks.getRecent(
  numberOfItems          // integer
)

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. The minimum allowed value here is 1. If you pass 0 or less, the function will throw an error.

Return value

A Promise that will be fulfilled with an array of BookmarkTreeNode objects.

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 onFulfilled(bookmarks) {
  for (bookmark of bookmarks) {
    console.log(bookmark.url);
  }
}

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

var gettingRecent = browser.bookmarks.getRecent(1);
gettingRecent.then(onFulfilled, onRejected);

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: wbamberg, Makyen, Sheppy
 Last updated by: wbamberg,