http://www.chrispearson.org/pages/programming/javascript/addfavourite.asp
09h27
Wednesday, 8. October 2008

ADD TO FAVORITES

The current page can be added to the Internet Explorer Favorite list by invoking the AddFavorite method and passing the url and title of the current document. View the cource code to see the scripting. Note that this only works with IE.

Supported by JavaScript, the "Bookmark this page" hyperlink

Bookmark this page
which is coded
   <a href="javascript:addbookmark()">
      
calls a function to add this current page to the favourites conatined in the Internet Explorer Favorites list.
   function addbookmark()
 	{
	    	if (document.all)
		    	window.external.AddFavorite(document.location.href,document.title);
		}
The addition of the two lines of script
		document.write("<BR><BR>Add the url <b>" + document.location.href + "</b><BR>");
		document.write("<BR>using the page title '<b>" + document.title + "</b>'<BR>");
shows the user which url will be added and what its default title will be. This technique invokes the IE AddFavorite method, which launches the Add Favorite dialog box - The user needs to click on OK to accept the default given.

xxx,xxx

copyright ©2000 - 2008 Chris Pearson