Homepage, add favorites compatible 360/Firefox/Google/ie and other mainstream browser code

Source: Internet
Author: User


JS Code:
Copy code code as follows://Set to Home function Sethome (OBJ,VRL) {try{obj.style.behavior= ' url (#default #homepage) '; Obj.sethomepage (VRL);} catch (E) {if (Window.netscape) {try {netscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect");} catch (E) {alert ("This operation was rejected by the browser.) \ nplease type "About:config" in the browser address bar and enter \ n then set the value of [Signed.applets.codebase_principal_support] to ' true ' and double-click. "); } var prefs = components.classes[' @mozilla. Org/preferences-service;1 '].getservice ( Components.interfaces.nsIPrefBranch); Prefs.setcharpref (' Browser.startup.homepage ', VRL); }else{alert ("Your browser does not support, follow these steps: 1." Open browser settings.) 2. Click the Settings page. 3. Input: "+vrl+" click OK. "); } } } Add Favorites compatible and IE6 function Shoucang (stitle,surl) {try {window.external.addFavorite (sURL, stitle);} catch (e) {try {WI Ndow.sidebar.addPanel (Stitle, sURL, "");} catch (E) {alert ("Join collection failed, add with Ctrl+d");} }



Calling code:
Copy code code as follows:



       Set as homepage
|
Add to Favorites
|





Favorites and set as home code for the name style
There are some of the most basic HTML code, only for beginners to refer to.
Note: This code is only compatible with IE browser
1: Realize "
The code for the Add Favorites feature is as follows:
Copy code code as follows:



Http://www.baidu.com ', ' Baidu ') ' > Add to Favorites



You can simply change the link and station name to your own station name.
If you want to implement the mouse when you are prompted to join the collection, simply change the code to:
Copy code code as follows:



Http://www.baidu.com ', ' Baidu ') "Target=_self href= > Add to Favorites



----------------------------------
2. Set homepage code (HTML source)
Copy code code as follows:





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.