JavaScript Set homepage and favorite//<a href= "Javascript:addfavorite (window.location,document.title)" > Favorites </a>//it calls the ADD Favorite dialog box in IE and links to a URLs in Firefox and Safari (but again not Opera). Geovin du//http://stackoverflow.com/questions/946189/ how-can-i-set-default-homepage-in-ff-and-chrome-via-javascript//http://www.webdeveloper.com/forum/ Showthread.php?180428-set-homepage-script//ie 11.0 Windows7 invalid. function Addfavorite (sURL, stitle) {try {window . External.addfavorite (sURL, stitle); } catch (e) {try {Window.sidebar.addPanel (stitle, sURL, ""); } catch (e) {alert ("Add to collection failed, please use ctrl+d for adding"); }}}//<a href= "#" onclick= "Javascript:sethome (this,window.location);" > Set homepage </a>//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! \ n Please enter "About:config" in the browser address bar and return to \ 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.nsIPref Branch); Prefs.setcharpref (' Browser.startup.homepage ', VRL); } }}
JavaScript Set homepage and favorite