Link "Add to favorites" for all browsers
Multiplatform solution
After digging, eventually 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 updated 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 about how to 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>
Comments
When commenting on, remember that the content and tone of your message can hurt the feelings of real people, show respect and tolerance to your interlocutors even if you do not share their opinion, your behavior in the conditions of freedom of expression and anonymity provided by the Internet, changes Not only virtual, but also the real world. All comments are hidden from the index, spam is controlled.