Q: chrome.bookmarks.create throws error "Cannot call method 'create' of undefined" Hi I want to create a very simple extension for Chrome, that will create a bookmark with a single click to a default folder. So I created an extension using this service:
http://sandbox.self.li/bookmarklet-to-extension/
Now, I have this json.manifest file
{
 "background": {"scripts": ["background.js"]},
 "browser_action": {
 "default_icon": "icon-128.png",
 "default_title": "1ClickBookmark"
 },
 "name": "1ClickBookmark",
 "description": " - Created with http://blog.self.li",
 "homepage_url": "http://blog.self.li/post/16366939413/how-to-convert-bookmarklet-to-chrome-extension",
 "icons": {
     "16": "icon-16.png",
     "48": "icon-48.png",
     "128": "icon-128.png" },
 "permissions": [
     "tabs",
     "bookmarks",
     "http://*/*",
     "https://*/*"
 ],
 "version": "0.1",
 "manifest_version": 2
}

where I added "bookmarks to permission"
and the javascript file:
(function(){
  chrome.bookmarks.create({
  'parentId': null, 
  'title': 'AAAAAAA', 
  'url': 'http://www.google.com/'});
  alert("Bookmark added!");
})();

ParentId=null points to the root of "Other Bookmarks", that is fine.
The problem is that in Console I catch an exception:
"Cannot call method 'create' of undefined" for chrome.bookmarks.create
However, if I run just that script directly in the Background console it works just fine.
In Background console - work, in standard console - fails.
Why?
Any advice would be appreciated. Thanks

A: If you want your script to run in the context of other pages you must use content scripts. As it stands, your extension is only "running" on the background page. So your background page has access to the chrome.* object, but other pages will not until they are injected with a content script.

A: Have you tried to reinstall your extension after adding permission to manifest.json?
