Return to Snippet

Revision: 51060
at September 13, 2011 16:42 by mariraj


Initial Code
HTML
----------------------------------------------------------------------------------------------------
 
<a href="javascript:viod(0);" onclick="addBookmark(); return false;">Book mark</a>
 
 
JAVA SCRIPT
---------------------------------------------------------------
 
 
function addBookmark( title, url )
{
 if (title == undefined)
  title = document.title;
 if (url == undefined)
  url = top.location.href;
  
 if (window.sidebar) // firefox
  window.sidebar.addPanel(title, url, '');
 else if(window.opera && window.print) // opera
 {
  var elem = document.createElement('a');
  elem.setAttribute('href',url);
  elem.setAttribute('title',title);
  elem.setAttribute('rel','sidebar');
  elem.click();
 } 
 else if(document.all) // ie
  window.external.AddFavorite(url, title);
 else if (navigator.appName=="Netscape") //Netscape
  alert( 'To bookmark this site press "Ctrl+D".' );
 else
  alert( 'Your browser doesn\'t support this feature' );
}

Initial URL

                                

Initial Description
Page Book mark using code

Initial Title
User defined Book mark

Initial Tags

                                

Initial Language
JavaScript