Movatterモバイル変換


[0]ホーム

URL:


  1. Mozilla
  2. Add-ons
  3. Browser extensions
  4. JavaScript APIs
  5. bookmarks
  6. bookmarks.remove()

bookmarks.remove()

Thebookmarks.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 aPromise.

Syntax

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

Parameters

id

Astring specifying the ID of the bookmark or empty folder to remove.

Return value

APromise that will be fulfilled with no arguments.

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

Examples

js
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

Browser compatibility

Note:This API is based on Chromium'schrome.bookmarks API. This documentation is derived frombookmarks.json in the Chromium code.

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp