Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help, Javascript Extension to set FireFox, Chrome Homepage.

Status
Not open for further replies.

HopnDude

IS-IT--Management
Oct 25, 2007
64
0
0
US
Kind of what the Subject says.

I work for a Library. I have ALMOST everything locked down and set! IE cannot be changed, and the homepage is the Library website. By request we are going to use FireFox and Chrome on all the computers as well. So this is the issue.

I need help making a Javascript (my programming skills are extremely minimal) Extension for both FireFox and Chrome to PERMANENTLY ,or unless the Local Admin on the specific PC says otherwise, to "ourlibrary.org" as the homepage.

Any help pointing me in the right direction would be greatly appreciated!
 
i have not built any firefox extensions but I believe the relevant code for setting the home page is the following

Code:
Components.utils.import("resource://gre/modules/Services.jsm");
Services.prefs.setCharPref("browser.startup.homepage", "[URL unfurl="true"]http://myhomepageishere.com);[/URL]

the alternative, perhaps, is to use a prefs file for mozilla. I think you do something like this:

Code:
pref("general.config.obscure_value", 0); 
pref("general.config.filename", "mozilla.cfg");

Code:
lockPref("browser.startup.homepage", "data:text/plain,[URL unfurl="true"]http://myhomepage.com");[/URL]

or to save you from having to update everything the whole time you could do this

Code:
lockPref("autoadmin.global_config_url","[URL unfurl="true"]http://internaldomain/auto-config-file.js");[/URL]

and then put whatever you want in the auto-config file on the server. (same format as the lockPref line).

as said, I've never had to do any of the above as, in a domain controlled environment, it's easier to use IE and lock it down in group policies. and even then, it was quite a few years ago that I was involved with windoze.
 
So am I supposed to create new .js/.cfg files?

I've been scouring through Mozilla in the about:config (title bar) settings. But I'm not finding anything relevant. I've changed the homepage setting, but I can still change it through settings.

IE's homepage through AD cannot be changed! None of the IE settings can be changed! There are some pages that won't display in IE, so we've installed Chrome and FireFox on the patron PC's. I just need to permanently set the Chrome/FireFox homepages to "ourlibrary.org".

I tried the first three things you put, but it's not working yet.

UPDATE: As I was typing this, I tried them out. If I make the .js file and put it into "C:\Prog~Files\Mozil~FireFox\defaults\pref" when I close/open FireFox I get an error. That .js cannot be read.

Is there anything in about:config that I can edit to manually set the homepage so that it cannot be changed?
 
not a new prefs file. but yes, a new cfg file.

this article seems to mirror what I recalled above. although it says that the cfg file should be in the executable directory. i don't have a windoze pc to test that on.

i posted three methods above. the first code block was the method for a browser extension.
code blocs two and three were those necessary for a 'policy-type' solution. not really javascript.
the third was as for solution two but provided you a way of remote administration.

the.js file is the prefs.js. my recollection is that this was called local-settings.js but I see that this is no longer the case (or perhaps never was).

the cfg file is the one that actually has the lock values in it.

If for some reason it still does not work and errors out, try deleting the "the data:text/plain," segment and just leave the url.

the lockprefs stops the about:config from being edited (as to those matters that are being locked). thus I believe that this is the route you want.

to stop the mozilla.cfg file being changed you could remove the user write permissions. but this might break upgrades. a better answer might be to have your logon script automatically recreate that file, or download a copy from a server etc.
 
I think I know what you mean by the "mozilla.cfg" file now. Back in 2005 you could take a file, let's name it "mozilla.txt" run it through a 13 bit shift transfer, then through a microsoft encryption tool to give us an output of a .cfg file. Take that file and move the original, then put the mozilla.cfg new file in it's place. This won't work with the newer version of Mozilla FireFox if that is what you are referring to. I already tried that before posting this.

It's not a huge deal if it can't be done. But would remove a huge headache from the employee's out in the Library that would have to deal with it. I'm just trying to make their lives easier by doing mine properly!
 
it can be done. but you don't need the bit shifting any more if you include the no-obfuscation line.

or at least that's what I read in the Jan 2013 kb article
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top