JavaScript code to add bookmark of the site

Hi,

 

Although the bookmarking techniques in the browser have improved a lot, but still many a times we want to provide a simple way to the user in the web site itself to Bookmark the site. This can be done very simply with the help of the JavaScript.

 

One problem though is there that implementation of this functionality is different for different browser. Below piece of code has been testing in both firefox and Internet explorer to work properly.

 

function addToBookMarks()
{

if(document.all)
{
     window.external.AddFavorite(location.href,document.title);
}

else if(window.sidebar)
{
     window.sidebar.addPanel (document.title,location.href,'');
}

}

 

Vikram


Share this post   Email it

Feedback

Posted on 4/10/2009 4:29:05 AM

Nice article Vikram...

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Copyright © 2006 - 2010 Vikram Lakhotia