my first extension - add bookmark with a click - HOW TO?
I am learning to write javascript and chrome extension. I want an extension that will show a button, and on a click it will add a bookmark folder in the bookmarks. So far so good, got the button, but clicking it adds nothing.
I suppose my javascript is not correct:
here is the code
manifest:
Code:
{
"name": "My First Extension",
"version": "1.0",
"background_page": "background.html",
"permissions": [
"tabs", "http://*/*", "bookmarks"
],
"browser_action": {
"default_icon": "icon.png",
"name": "HELLO WORLD"
}
}
Code:
background.html
<html>
<head>
<script>
function updateIcon() {
chrome.bookmarks.create({parentId: bookmarkBar.id,
title: 'Extension bookmarks'});
}
chrome.browserAction.onClicked.addListener(updateIcon);
updateIcon();
);
</script>
</head>
</html>
I suppose it is
Code:
function updateIcon() { chrome.bookmarks.create({parentId: bookmarkBar.id,
title: 'Extension bookmarks'});
}
that is wrong.
Please, advice me and any ggod places for learning javascript. I have read http://code.google.com/chrome/extensions/bookmarks.html already