Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

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>

Share this article   |    Print    |    Article read by 5214 times
Rohit kakria
I am software developer, moderator of
Related Articles:
Related Interview Questions: No related interview question