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
.
var gettingRecent = browser.bookmarks.getRecent( numberOfItems // integer )
numberOfItems
A Promise
that will be fulfilled with an array of BookmarkTreeNode
objects.
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);
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
getRecent |
Yes |
79 |
47 |
? |
Yes |
No |
? |
? |
No |
? |
? |
? |
Note: 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.
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks/getRecent