Xpode.com        Click here to Print this article.

Bookmark Page using Javascript

Have you seen the word Bookmark this page or Add to favourite on websites. There is a small script trick to do this. We will have to write some code in HTML head section and call in body tag

To check the example, Please click on Bookmark this page! or Add to favourites!

Javascript code for these link is given below. Select this code and paste in header section.

<script type="text/javascript" >

      function bookmarksite(title,url)

        if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
        else if(window.opera && window.print){ // If browser is opera
        var elem = document.createElement('a');


      else if(document.all)//  If browser is ie

       window.external.AddFavorite(url, title);



Now Paste this code in body section.

<a href="javascript:bookmarksite(location.href, location.href)">Bookmark
this site!</a>


Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com

Click here to go on website