Tuesday, November 11, 2008

AddToFavorites function for IE6, Firefox 3 and Opera 9.6

Solution presented here and in some other places, offered by google doesn't work for me. The solution is to have a link <a href="#" onclick="addToFavorites();" rel="sidebar" id="addToFavoritesLink">Add to Favorites</a> with rel=sidebar attribute.
There are some tricks for this. When you click the link the name for link in the dialog box equals to the title attribute of your link. So i added a javascript function onclick="addToFavorites();". I do the following
function addToFavorites()
{
var lnk = document.getElementById('addToFavoritesLink');
if (lnk!=null)
{lnk.title = 'Some name';}
}