Advertisement
2002ASP Internet/ Browsers/ HTML #8283

Add to Favorites - Dynamically!

After searching throughout the web for a JavaScript function that would add a web page to a users favorites folder, I grew increasingly impatient with the laziness of others code, (hey why re-create the wheel?) because others code only lets you add one page to a users favorites folder. Therefore, I created a DYNAMIC “Add to Favorites” function, that for example will add the web page where the code is located to the users favorites. Just create an include virtual, (for script) and insert the include onto all of your pages, or preferably if you have a header page include, just copy the code into that – and Voila! As long as you have the TITLE tags on your page, you’re set!

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<HTML>
 <HEAD>
 <TITLE>ADD To Favs</TITLE>
 <SCRIPT language="JavaScript1.2">
 	var bookmarkurl = window.location.href;
 	var bookmarktitle = document.title;
 	function addfav(){
 	if (document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle);
 	}
 </SCRIPT>
 </HEAD>
 	<BODY>
 		<A href="javascript:addfav()">Add page To favorites</A>
 	</BODY>
 </HTML>
Original Comments (3)
Recovered from Wayback Machine