Adding Bookmark This link to your website using javascript

We could easily add a bookmark this site link or add to your favorite sites link using javascript by adding the following code to your website:

<script language="javascript">
function addBookmark()
{
bookmarkurl = "http://www.tildemark.com";
bookmarktitle="Tildemark blogs";
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
else if ( window.sidebar ) {
window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
}
}
</script>

You can then place your bookmark link by adding an onClick function on your anchor tag like this:

<a href="javascript:addBookmark();">Bookmark this page!</a>

Here’s a sample code:
Bookmark this page!
Please note that this code is browser dependent.

Comments

3 Comments on "Adding Bookmark This link to your website using javascript"

  1. Thanks for the JS code. I was looking for this to add a bookmark tag on my blog.
    Sandeep
    http://sandeep-aparajit.blogspot.com

  2. Craig says:

    Does not work in IE8 (tested your link).

  3. Everyone says:

    *PLEASE* post actual working code.
    Your ‘example’ doesn’t even have matching {} characters and will *NEVER* run as written.


Here's your chance to leave a comment!