0
我目前正在建立一個谷歌瀏覽器擴展程序,可從瀏覽器中獲取書籤,並將它們發送到從同步視角服務器,但它似乎總是抱怨我的「permission error
」爲「API method
background.html
「中使用的」」,儘管我已在必要的權限 「manifest.json
」書籤允許谷歌瀏覽器
這裏什麼my manifest.json
樣子
{
"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"
]
}
,在這裏我background.html代碼
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);
});
}
//上面的代碼是從以下link
現在使用,如果嘗試調試上面的代碼在Chrome開發者控制檯 它返回一個錯誤的permission of the API methods used.