Bookmark a Page With Javascript

I have been asked a few times how to add a bookmark link within a HTML page, so that people can just click the link and the website will be added to their bookmarks.

This is pretty straight forward to do, here is the code you would need:

<a href="javascript:window.external.AddFavorite
('http://stillaslife.com/code/bookmark-a-page-with-javascript/','Bookmark a Page With Javascript | Still As Life')">
Bookmark this page!</a>

This will create something like this: Bookmark this page!

All you need to change is the link to be the link to the page being bookmarked, then the second part ‘Bookmark a Page With Javascript | Still As Life’ is the title of the page being bookmarked. This should be whatever you want the bookmark to be titled.

Nowadays this is becoming less common as social bookmarking sites such as those below this blog post are becoming more popular, of course there are still plenty of people using regular bookmarks.

It’s probably also worth noting, to my knowledge, this only works in Internet Explorer. Enjoy.

Leave a comment