Native JS Write set homepage compatible IE, Firefox and Google

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.