问题
I'm creating a Chrome Extension that can saves and retrieves bookmarks specific only to the user. Bookmarks are stored in the local disk in a form of a file. So I use the bookmarks API of Google Chrome. But somehow their sample code doesn't work for me.
function bkmk(){
chrome.bookmarks.create({'parentId': bookmarkBar.id,
'title': 'Extension bookmarks'},
function(newFolder) {
alert(newFolder.title);
});
}
I trigger the function with an onclick event on a button.... Is there something wrong with this? Note: I already gave permission to Bookmarks API in the manifest.
Edited to add OP's comment
oh.. this one is fine now... I just used a wrong entry for the folder ID.. I used a non-existing ID of a bookmark node that's why it did not create a bookmark/folder... now my concerns are a.) how to tell chrome not to add the bookmarks in the default user but rather insert the bookmark in a file generated by my extension and b.) how to load the bookmarks to the bookmarks bar using the file generated by my extension instead of loading the default user's bookmarks?????
来源:https://stackoverflow.com/questions/8928597/google-chrome-bookmarks-api