Add to favourites link for Google Chrome
There is no way to do it in all browsers. Even in Firefox it doesn't work as expected as it adds a sidebar (on newer versions the user can change that, if he finds the checkbox).
So I am sorry to tell you that you can't. I would provide a social bookmarks widget or ask the user to press CTRL + D to bookmark a page.
Found the Bookmarks API for extensions...
This piece of code needed to be inside a function in the background page:
chrome.bookmarks.create({'parentId': bookmarkBar.id,'title': 'Extension bookmarks'},
function(newFolder) {
console.log("added folder: " + newFolder.title);
});
Then had to call the function like this:
<a href="javascript:addfav()">Add to bookmarks</a>
The bookmark code you suggested at the top of this topic only works if you're using JavaScript but doesn't work on certain websites, especially those using HTML. I've tried to implement it into my Blogger blog with no succession. However, Chrome handles javascript:window.print()
very easily, why can't Google just create a handle like javascript:window.bookmark()
, wouldn't that not be so much easier?
There is another way. Since Google Bookmarks is available, try using
http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=bookmarklinkgoeshere&title=bookmarktitlegoeshere
if you're using HTML instead of JavaScript. This way, you can use Google Bookmarks as a cross-browser tool instead of relying on Google Chrome handle API all the time. Instead, just add a link on the Bookmarks Bar on Chrome, the link to http://www.google.com/bookmarks
so you can create new bookmarks and open existing ones.
Make sure to include the www since http://google.com/bookmarks
doesn't work at all.