Code for "Bookmark this page"...

blade

GEEK 2.0
I need the javascript code that'll add your Website to a browsers favorites with a click of a button.

This is the current code I use:
<a href="javascript:window.external.AddFavorite('WEBSITE', DESCRIPTION')">

but there are 2 problems:

1.) It only works for IE, I want one that'll work for Opera and Firefox as well; Safari too if possible

2.) This code will only add the Website link you specified in the code. I want one that'll bookmark individual pages meaning people can bookmark the current page they're on instead of only being able to bookmark the Website you specified in the javascript code
 
It only works for IE, I want one that'll work for Opera and Firefox as well; Safari too if possible
Try the following script instead:
Code:
<script language="JavaScript1.2" type="text/javascript">
 function CreateBookmarkLink() {

 title = "Webpage Title"; 
  // Blogger - Replace with <$BlogItemTitle$> 
  // MovableType - Replace with <$MTEntryTitle$>

 url = "Webpage URL";
  // Blogger - Replace with <$BlogItemPermalinkURL$> 
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

	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:CreateBookmarkLink()");">Add to Favorites</a>'); 
  } else  if (window.sidebar) {
  document.write('<a href = 
    "javascript:CreateBookmarkLink()");">Bookmark Page</a>'); 
 } else if (window.opera && window.print) {	
   document.write('<a href =
     "javascript:CreateBookmarkLink()");">Add Bookmark</a>');
 } 
</script>
source
 
Back
Top