User defined Book mark


/ Published in: JavaScript
Save to your folder(s)

Page Book mark using code


Copy this code and paste it in your HTML
  1. HTML
  2. ----------------------------------------------------------------------------------------------------
  3.  
  4. <a href="javascript:viod(0);" onclick="addBookmark(); return false;">Book mark</a>
  5.  
  6.  
  7. JAVA SCRIPT
  8. ---------------------------------------------------------------
  9.  
  10.  
  11. function addBookmark( title, url )
  12. {
  13. if (title == undefined)
  14. title = document.title;
  15. if (url == undefined)
  16. url = top.location.href;
  17.  
  18. if (window.sidebar) // firefox
  19. window.sidebar.addPanel(title, url, '');
  20. else if(window.opera && window.print) // opera
  21. {
  22. var elem = document.createElement('a');
  23. elem.setAttribute('href',url);
  24. elem.setAttribute('title',title);
  25. elem.setAttribute('rel','sidebar');
  26. elem.click();
  27. }
  28. else if(document.all) // ie
  29. window.external.AddFavorite(url, title);
  30. else if (navigator.appName=="Netscape") //Netscape
  31. alert( 'To bookmark this site press "Ctrl+D".' );
  32. else
  33. alert( 'Your browser doesn\'t support this feature' );
  34. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.