Add to favorites / bookmarks


Guys here is a very simple javascript to add a link of bookmark this page(for mozilla) or add to favorite (for IE)

<script language=”JavaScript1.2″ type=”text/javascript”>
function createBookmark() {

var title = document.title;
var url = window.location.href;

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; }
}

if (window.external) {
document.write(‘<a href = “javascript:createBookmark()”);”>Add to Favorites</a>’);
} else  if (window.sidebar) {
document.write(‘<a href = “javascript:createBookmark()”);”>Bookmark Page</a>’);
} else if (window.opera && window.print) {
document.write(‘<a href =”javascript:createBookmark()”);”>Add Bookmark</a>’);
}
</script>

Advertisements