This is some SEO Text
Home Web Design Web Resources Add To Favorites link

Web Design

How to add an "Add To Favourites" link

Probably the most important reason to include this little piece of code on your website is not so much to make it easier to add your pages to a viewers "favorites" but it visually reminds them to do so.

This is a three part element but with four things to do.

1) Add the code to your page

Place this piece of code where you want the Add To Favorites link to be on your web page:

<table cellpadding="0" cellspacing="0"><tr><td><a href = "javascript:CreateBookmark();"><img src="fav_ie.gif" alt="" width="16" height="15" border="0"></a></td>
<td>&nbsp;<a href ="javascript:CreateBookmark();" class="blue_link_sm">Add to Favorites</a>&nbsp;</td></tr></table>

Make sure to paste it as CODE and not as text.

2) Add this script to your head tags.

<script src="default.js" language="Javascript" type="text/javascript"></script>

3) Add a javascript file to your server

Download default.js

Either donwnload the file above or create it yourself by creating a blank document and DELETE ALL THE HTML CODE IT ALREADY MAY CONTAINS.

Copy the text below:

function CreateBookmark() {

var title = (typeof(document.title)!='undefined'?document.title:'SteveBraithwaite.com');
var url = this.location;
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;
}
}

and paste it into the new blank document.

Now save the file as default.js
Upload it to the same destination folder as your pages with the Add To Favorites code.

(You will need to add the file default.js in all the folders that have pages with the Add To Favorites code).

IMPORTANT: Carefully change the text that says "stevebraithwaite.com" to your domain name

Now add the star icon.

Right click this little icon, choose "Save Picture As..." and save it to your hard drive in same folder as the other files above.
Then upload it to your website.

 

If you add all the above code to pages in other folders you will also have to change all the various paths.
That's a bit beyond the pervue of this tutorial however.