Javascript to add bookmark option on your website

If you want to add an option that users can click a button on your website and it will open up bookmark option. Following is the code that will perform this task.

<html>
<body>
<SCRIPT LANGUAGE="JavaScript">
function bookmark(url, description)
{
if (navigator.appName=='Microsoft Internet Explorer')
{
window.external.AddFavorite(url, description);
}
else
{
alert('This option works with IE only as of now.');
}
}

</SCRIPT>
<input type="Button" ID="btnBookMark" onClick="bookmark('http://mypage.aspx','MyWebsite')" value="Bookmark" />
</body>
</html>

No Comments