bookmarks.remove()
方法用于删除单个书签或一个空的书签文件夹。
如果你的扩展尝试从书签树的根节点中移除一个书签,该调用将会引发一个“书签根不能被修改的”的错误信息并且这个书签不会被移除。
这是一个异步方法,返回Promise对象。
语法
var removingBookmark = browser.bookmarks.remove(
id // 字符串
)
参数
id
string
要删除的书签或空书签文件夹的id标识
返回值
浏览器兼容性
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
例子
function onRemoved() {
console.log("Removed!");
}
function onRejected(error) {
console.log(`An error: ${error}`);
}
var bookmarkId = "abcdefghijkl";
var removingBookmark = browser.bookmarks.remove(bookmarkId);
removingBookmark.then(onRemoved, onRejected);
Example extensions
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.