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

js
let 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.

Examples

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

js
function onFulfilled(bookmarks) {
  for (const bookmark of bookmarks) {
    console.log(bookmark.url);
  }
}

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

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
getRecent
Chrome – Full support
Chrome 5 (Release date: 2010-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 47 (Release date: 2016-06-07)
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.