Spec-Zone.ru › Web Extensions

bookmarks.remove()

The bookmarks.remove() method removes a single bookmark or an empty bookmark folder.

Warning: If your extension attempts to remove a bookmark from the bookmarks tree root node, the call will raise an error with the message: "The bookmark root cannot be modified" and the bookmark won't be removed.

This is an asynchronous function that returns a Promise.

Syntax

let removingBookmark = browser.bookmarks.remove(
  id                 // string
)

Parameters

id

A string specifying the ID of the bookmark or empty folder to remove.

Return value

A Promise that will be fulfilled with no arguments.

If the node corresponding to the id parameter can't be found or was a non-empty folder, the promise is rejected with an error message.

Examples

function onRemoved() {
  console.log("Removed!");
}

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

let bookmarkId = "abcdefghijkl";

let removingBookmark = browser.bookmarks.remove(bookmarkId);
removingBookmark.then(onRemoved, onRejected);

Example extensions

  • bookmark-it

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
remove Yes 15 45 ? Yes No ? ? No ? No ?

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

© 2005–2023 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/remove

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API