Return to Snippet

Revision: 7287
at July 17, 2008 06:40 by scarfboy


Initial Code
function addToBookmarks(url,title) {
  if (window.external && window.external.AddFavorite) 
    window.external.AddFavorite(url,title);   // IE4 and later
  else if (window.sidebar && window.sidebar.addPanel)
    window.sidebar.addPanel(title,url,'');    // Gecko/firefox
}

//use e.g. like:
addToBookmarks(window.document.location, window.document.title);

Initial URL


Initial Description
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

Initial Title
Javascript add-to-bookmarks (Firefox, IE)

Initial Tags
javascript

Initial Language
JavaScript