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 header:

  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 for adding a page to a page can look like this:

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

Add to Favorites - script for all browsers

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

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

Make Startup Script for IE

  <a href = "" onclick = " = 'url (# default # homepage)'; this.setHomePage ('http: //www.shram. '); 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 header:

  function getBrowserInfo () {
  var t, v = undefined;
  if ( 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 for adding a page to a page can look like this:

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