This page has been robot translated, sorry for typos if any. Original content here.

Link "Add to Favorites" for all browsers

Ссылка Добавить в избранное для всех браузеров

Multiplatform solution

Having rummaged, as a result I made a beautiful decision, it works in all browsers.

Put these features in the page title:

  <script>
  function add2Fav (x) {
  if (document.all &&! window.opera) {
  if (typeof window.external == "object") {
  window.external.AddFavorite (document.location, document.title);
  return true;
  }
  else return false;

  }
  else {
  x.href = document.location;
  x.title = document.title;
  x.rel = "sidebar";
  return true;
  }
  }
  </ script>
 

The link to add a page to the page may look something like this:

  <a href="#" onClick="add2Fav(this)"> Add to favorites </a>
 

Add to Favorites - script for all browsers

  <a href = "http://www.shram.kiev.ua/" rel = sidebar title = "Site name" onclick = "window.external.AddFavorite ('http://www.shram.kiev.ua/' , 'Site name'); return false; "> Add to favorites </a>
 

Change Site Name and URL in 2 places! Works everywhere without errors)

Make Startup Script for IE

  <a href = "http://www.shram.kiev.ua/" onclick = "this.style.behavior = 'url (# default # homepage)'; this.setHomePage ('http: //www.shram. kiev.ua/ '); return false; "> Make homepage </a>
 

Change the URL in 2 places! Only works in IE

JavaScript Add to Favorites link for all browsers

The script was found in google and refined to reflect the current realities, namely, the presence of the 8th version of IE and the Chrome browser (which in its original form was defined as Netscape and no actions were taken as a result). If the browser does not support bookmarking through a script, the user will be shown a message about what to add to bookmarks by pressing Ctrl-D.

Put these features in the page title:

  <script>
  function getBrowserInfo () {
  var t, v = undefined;
  if (window.chrome) t = 'Chrome';
  else if (window.opera) t = 'Opera';
  else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf ('MSIE') + 5;
  v = nv.substring (s, s + 1);
  }
  else if (navigator.appName) t = 'Netscape';
  return {type: t, version: v};
  }
  function bookmark (a) {
  var url = window.document.location;
  var title = window.document.title;
  var b = getBrowserInfo ();
  if (b.type == 'IE' && 8> = b.version && b.version> = 4) window.external.AddFavorite (url, title);
  else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url + ',' + title;
  return true;
  }
  else if (b.type == "Netscape") window.sidebar.addPanel (title, url, "");
  else alert ("Press CTRL-D to bookmark the page.");
  return false;
  }
  </ script>
 

The link to add a page to the page may look something like this:

  <a href = "javascript: void (0);"  onclick = "return bookmark (this);"> Add to favorites </a>