PDA

View Full Version : Set Homepage


Donrajah
03-30-2009, 09:27 AM
i use this script for my web site and it doesnt work for setting it as homepage

function setHomepage() {
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage('http://www.www.com');

}
else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege ("UniversalXPConnect");
}
catch (e) {
alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', 'http://www.www.com');
}
}

i cant find the error...can some one provide me with a working javascript for setting homepage

bruce
03-30-2009, 09:46 AM
found these postings

http://scripts.tropicalpcsolutions.com/html/javascript/save-website-as-homepage-javascript.html

http://www.boutell.com/newfaq/creating/sethomepage.html

Donrajah
03-30-2009, 08:56 PM
found these postings

http://scripts.tropicalpcsolutions.com/html/javascript/save-website-as-homepage-javascript.html

http://www.boutell.com/newfaq/creating/sethomepage.html

does this work in firefox... in fact the first one is the same as my script

bruce
03-31-2009, 10:05 AM
i have not tried but i think it should work on ff