Javascript code for “Add To Favorites” in browser

Whenever i open any site today, i can see “Add to Favorite” link on it. So, i think why should i not try this??

When i was search code for it, i don’t get exact…Simple code for “Add To Favorite” is window.external.AddFavorite(url, title).

But it was not working in all browser….So today i come up with multibrowser “Add To Favorite” link.

<script type="text/javascript">

function CreateBookmarkLink()
{
title = "Your Display Title";
url = "URL To Save in BookMark";
if (window.sidebar)
{
// Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url, "");
}
else if (window.external)
{
// IE Favorite
window.external.AddFavorite(url, title);
}
else if (window.opera && window.print)
{
// Opera Hotlist
return true;
}
}
if (window.external)
{
document.write('<a href ="javascript:CreateBookmarkLink()");">Add to Favorites</a>');
}
else if (window.sidebar)
{
document.write('<a href ="javascript:CreateBookmarkLink()");">Bookmark Page</a>');
}
else if (window.opera && window.print)
{
document.write('<a href ="javascript:CreateBookmarkLink()");">Add Bookmark</a>');
}
</script>