1 //Set as homepage2 //<a href= "javascript:void (0);" onclick= "Sethome (this,window.location)" > Set homepage </a>3 functionsethome (obj, url) {4 Try {5obj.style.behavior = ' url (#default #homepage) ';6 obj.sethomepage (URL);7}Catch(e) {8 if(window.netscape) {9 Try {TenNetscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect"); One}Catch(e) { AAlert ("Sorry, this operation was rejected by the browser!") \ n \ nyou Enter "About:config" in the browser address bar and return and set [Signed.applets.codebase_principal_support] to ' true '); - } -}Else { theAlert ("Sorry, the browser you are using cannot complete this operation.") \ n \ nyou need to manually set the "+ URL +" setting to the home page. "); - } - } - } + //Bookmark this site - //<a href= "javascript:void (0);" onclick= "Addfavorite (window.location,document.title)" > Add to Favorites </a> + functionaddfavorite (title, url) { A Try { at window.external.addFavorite (URL, title); -}Catch(e) { - Try { -Window.sidebar.addPanel (title, URL, "")); -}Catch(e) { -Alert ("Sorry, the browser you are using cannot complete this operation.") \ n \ nthe bookmark failed, please use Ctrl+d to add "); in } - } to } + //Save to Desktop - //<a href= "javascript:void (0)," onclick= "Todesktop (location.href,document.title)" > Save to Desktop </a> the functiontodesktop (sURL, sName) { * Try { $ varWshShell =NewActiveXObject ("Wscript.Shell");Panax Notoginseng varOurllink = Wshshell.createshortcut (Wshshell.specialfolders ("Desktop") + "\ \" + SName + ". url"); -Ourllink.targetpath =sURL; the Ourllink.save (); +}Catch(e) { AAlert ("The current IE security level does not allow operation!") "); the } +}
Native JS Write set homepage compatible IE, Firefox and Google