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

Link "Add to favorites" for all browsers

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

Multiplatform solution

After digging, in the end found a beautiful solution, works in all browsers.

Put these functions 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 building 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 the Site Name and URL in 2 places! Works everywhere without errors)

Make the 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; "> Set as home page </a>
    

Change the URL in 2 places! Works only in IE

JavaScript "Add to favorites" link for all browsers

The script is found in google and modified to reflect the current realities, namely, the presence of the 8th version of IE and the Chrome browser (which in the original script was defined as Netscape and no actions were taken as a result). If the browser does not support adding to the bookmarks via the script, the user will be shown a message that you can add to the bookmarks by pressing Ctrl-D.

Put these functions 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 add the page to the bookmarks.");
         return false;
     }
     </ script>
    

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

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