Xpode.com        Click here to Print this article.

Bookmark this page/Add to favourite script

Have you seen the word Bookmark this page or Add to favourite on websites. There is a small script trick to do this. We will have to write some code in HTML head section and call in body tag

To check the example, Please click on Bookmark this page! or Add to favourites!

Javascript code for these link is given below. Select this code and paste in header section.

< script type=text / javascript >

function bookmarksite(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // If browser is opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)//  If browser is ie
window.external.AddFavorite(url, title);
}

Now Paste this code in body section.

< a href="javascript:bookmarksite(location.href, location.href)">Bookmark this site!



http://
http://

Contributed by:
Rohit kakria
I am software developer

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=301

Click here to go on website