Adding bookmark of the site with the help of JavaScript

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

No Comments