Javascript add-to-bookmarks (Firefox, IE)

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

There is no standard for this at all - this just looks for the hooks that exist in IE and gecko-type browsers.
See also and

Copy this code and paste it in your HTML
  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. }
  8. //use e.g. like:
  9. addToBookmarks(window.document.location, window.document.title);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.