The "add to favorites" link code that I use, works for firefox but not for Google chrome extensions. What should i use to create a link that adds to Chrome favorites/bookmarks
-
2Duplicate. http://stackoverflow.com/questions/992844/add-to-browser-favourites-bookmarks-from-javascript-but-for-all-browsers-mine-do – mcandre Jul 12 '10 at 17:06
-
1Possible duplicate of [Add to browser favorites/bookmarks from JavaScript but for all browsers (mine doesn't work in Chrome)?](https://stackoverflow.com/questions/992844/add-to-browser-favorites-bookmarks-from-javascript-but-for-all-browsers-mine-do) – YakovL Apr 20 '18 at 13:32
4 Answers
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>

- 12,494
- 5
- 50
- 73

- 13,619
- 15
- 45
- 51
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.

- 9,302
- 3
- 31
- 65
-
1You can do it in most browsers though and the question was how to add it to Chrome favourites. – Ed Bishop Jan 29 '13 at 12:02
-
1
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.

- 74,770
- 16
- 179
- 206

- 63
- 6
-
Thanks Xan. :D It's funny, the fact that `javascript:window.history()` and `javascript:window.print()` both work in the PS3 Internet Browser, PS4 Internet Browser, Google Chrome and other browsers but Google couldn't be bothered to create a bookmark handler! Seriously. Google Bookmarks works in the Internet Browser of the PlayStation 3 & PlayStation 4 consoles as well as through the Google Toolbar (which is for other browsers instead of Chrome) and Google Bookmarks is still really useful on Google Chrome, which is why I recommend it. – warrenwoodhouse Jul 14 '16 at 11:33
-
Here's the code as it would play out: `` - that code is what it would look like, with the target opening a new tab. Once you save a link, it redirects to the homepage of Google Bookmarks and lists all your bookmarked items including saved links that you've Starred during Google Search. – warrenwoodhouse Jul 14 '16 at 11:40
Use a sharing URL. Here are your available parameters:
bkmk
: Holds your URL.title
: Holds your title.annotation
: Holds your text.labels
: Holds your keywords or hashtags.
URL:
https://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}&annotation={text}&labels={hash_tags}
If you want to stay in contact with a project that regularly keeps up to date on these formats and APIs, then check us out! Github: Social Share URLs.

- 18,769
- 10
- 104
- 133