Posted By

scarfboy on 07/17/08


Tagged

javascript bookmarks


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

SpinZ
wizard04
jonhenshaw
jschilling


Javascript add-to-bookmarks (Firefox, IE)


 / Published in: JavaScript
 

There is no standard for this at all - this just looks for the hooks that exist in IE and gecko-type browsers. See also http://msdn.microsoft.com/en-us/library/ms535926(VS.85).aspx and http://developer.mozilla.org/en/docs/DOM:window.sidebar

  1. function addToBookmarks(url,title) {
  2. if (window.external && window.external.AddFavorite)
  3. window.external.AddFavorite(url,title); // IE4 and later
  4. else if (window.sidebar && window.sidebar.addPanel)
  5. window.sidebar.addPanel(title,url,''); // Gecko/firefox
  6. }
  7.  
  8. //use e.g. like:
  9. addToBookmarks(window.document.location, window.document.title);

Report this snippet  

You need to login to post a comment.