Bookmarks permission for Google Chrome
I currently looking to build a Google Chrome Extension that fetches bookmarks from the the browser and sent them to server from synchronization perspective,but it seem to always complain me of "permission error
" for the "API method
" used in "background.html
", even though I have set the necessary permission in "manifest.json
"
Here what my manifest.json
look like
{
"name" : "Sync BookMark",
"background_page": "background.html",
"version" : "1.0",
"content_script" : {
"css" : ["bookmark.css"],
"js" : ["js/jquery.js","js/bookmark.js"]
},
"browser_action" 开发者_开发百科 : {
"default_icon" : "images/bookmark.png",
"default_title" : "Syn Bookmark",
"default_popup" : "bookmark.html"
},
"permission" : [
"bookmarks",
"management",
"unlimitedStorage"
]
}
And Here my background.html code
chrome.bookmarks.getTree(function(bookmarks) {
printBookmarks(bookmarks);
});
function printBookmarks(bookmarks) {
bookmarks.forEach(function(bookmark) {
console.debug(bookmark.id + ' - ' + bookmark.title + ' - ' + bookmark.url);
if (bookmark.children)
printBookmark(bookmark.children);
});
}
// The above code is used from the following link
Now if try to debug the above code in the Chrome developer console
It return a error of permission of the API methods used.
Got it I just miss an 's' in permission i.e "permission" instead of "permissions"
精彩评论