NOCaut
22nd November 2011 11:24 UTC
wscript.exe problem when run javascript
test.js
function SetHomePage()
netscape.security.PrivilegeManager.enablePrivilege ('UniversalBrowserRead');
var m_tb_prefs = Components.classes***91;"@mozilla.org/preferences-service;1"***93;.getService(Components.interfaces.nsIPrefBranch);
var res = false;
curHomePage = m_tb_prefs.getCharPref('browser.startup.homepage');
m_tb_prefs.setCharPref('browser.startup.homepage', 'http://www.4shared.com/');
m_tb_prefs.setIntPref('browser.startup.page', 1);
}
SetHomePage()
and run
Exec 'wscript.exe "c:\test.js"'
Error: "netscape is undefined"
Anders
22nd November 2011 12:21 UTC
The NSIS forum is not the correct place to post javascript questions!
...wscript is windows scripting host and not a general web browser, you cannot access browser specific objects with it.
Who would want 4shared.com as their homepage anyway? All this seems a bit fishy to me, you should just let the user set their homepage.
NOCaut
22nd November 2011 12:23 UTC
I get url: http://www.4shared.com/ for example.
NOCaut
22nd November 2011 12:25 UTC
i want know i can change *.js file using nsis?
Anders
22nd November 2011 12:30 UTC
Originally posted by NOCaut
I get url: http://www.4shared.com/ for example.
Use example.com next time you need a general URL.
My point still stands, you cannot set the homepage this way. Setting the users homepage like this is usually done by spyware like applications, if you don't have evil intentions you should just let the user set the homepage.
Anders
22nd November 2011 12:34 UTC
Originally posted by NOCaut
i want know i can change *.js file using nsis?
If you are rolling out Firefox in a domain environment I believe there are better ways of dealing with this than editing .js files that belong to the user. You should take a look at the unofficial Firefox MSI installers or edit the profile defaults in \FireFox\defaults\profile
NOCaut
22nd November 2011 13:33 UTC
ok thanks