Accessing the Whole BooKmark Using Chrome API

1,377 views
Skip to first unread message

Viren Negi

unread,
Feb 10, 2011, 5:30:29 AM2/10/11
to Chromium-extensions
Hello
I am new in Developing Chrome Extension I'm in need to access
bookmarks using Chrome API
1. In the Google Chrome Extension Documentation there is mention of
"chrome.bookmarks.getTree " but it some seem to return a function and
not actual bookmarks or bookmark object.

2. I'm also running into permission error for using the above API
(chrome.bookmarks.getTree) in background.html , even though the
permission is firmly given in manifest.json file

{
"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",
"experimental",
"contextMenu",
"unlimitedStorage",
"tab"

]
}

3. Is there a "callback" available to find out that user(overall) has
added or remove a bookmark from the chrome browser
Any One There Please Share some Light on it

Regard
Viren Negi

PhistucK

unread,
Feb 10, 2011, 1:25:41 PM2/10/11
to Viren Negi, Chromium-extensions
See my comments inline.

PhistucK



On Thu, Feb 10, 2011 at 12:30, Viren Negi <ultimate....@gmail.com> wrote:
Hello
 I am new in Developing Chrome Extension I'm in need to access
bookmarks using Chrome API
1. In the Google Chrome Extension Documentation there is mention of
"chrome.bookmarks.getTree "  but it some seem to return a function and
not actual bookmarks or bookmark object.

(Nearly?) every method within the extension system is asynchronous, which means that the last parameter you specify is almost always a callback function (in case you need to get something or be notified that the operation is finished).

Specify that callback function and you will get the bookmark tree as an argument.
For example, open the Developer Tools for your background page and run this -
chrome.bookmarks.getTree(function(){console.log(arguments)}
You should see that everything is there.


2. I'm also running into permission error for using the above API
(chrome.bookmarks.getTree) in background.html , even though the
permission is firmly given in manifest.json file

{
 "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",
   "experimental",
   "contextMenu",
   "unlimitedStorage",
   "tab"

 ]
}


You have a typo. "permission" should be "permissions".
 
3. Is there a "callback" available to find out that user(overall) has
added or remove a bookmark from the chrome browser

Unless you are talking about bookmark events, I am not sure what functionality you are need.
 
Any One There Please Share some Light on it

Regard
Viren Negi

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Reply all
Reply to author
Forward
0 new messages