Click to See Complete Forum and Search --> : Adding to IE favourites menu through code?


amitabh
May 20th, 2002, 05:44 AM
How do I create a link that adds my page to the favourites menu of IE? For Netscape, I suppose it's Ctrl+D.

websmith99
October 9th, 2002, 03:25 PM
This will work for IE4+

<html>
<head>
<title>My page</title>
<script language="JavaScript" type="text/javascript">
function addToFavorite() {
window.external.AddFavorite(location.href, document.title);
}
</script>
</head>
<body>
<a href="#" onclick="addToFavorite(); return false">Add this page to favorites</a>
</body>
</html>


Documentation on AddFavorite() method:

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/addfavorite.asp

For Netscape, try to invoke the key code for control-D for the keydown event of the link.