Google Chrome Bookmarks API

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:39:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!