20th Dec 2007

Hacking Firefox at my library: instructions & stuff

I think I’ve done enough tinkering and tweaking with the Firefox hacking that I think I can share the instructions with the world. This post is on the long side, because I tried to make the instructions as clear as possible without too much tech speak, and without drowning you in too much minutia, while actually giving you proper instructions. Enjoy!

Now, you will need more than basic computer poking skills to make this work, and I must say, these instructions may not be *perfect* (for sooth, I’m basically trying to clean up my notes without having to rewrite everything). There are files to download and copy into places (userChrome.css and mozilla.cfg), and there are links to those files in the instructions. Make sure you get this working exactly how you want it before you try it on any other machines. Trust me, you don’t want to get to machine 4 and realize that you need to correct something big (I’ve *totally* been there ;D). If you have questions, post comments here, and I’ll do what I can. :)

Quick computer configuration context notes:

  • We have 4 “kiosk” machines right in front of the Information Desk, meant for catalog and quick internet stuff. Patrons only have access to a browser, readers for Adobe, Word, Excel, and Powerpoint, My Documents, Recycle Bin, basic Accessories, and Windows XP Accessibility tools.
  • The Reference room has 4 computers, and the Computer Lab has 6 computers. These computers are more “normal,” with the full Office Pro suite, FTP and web editing freeware, IM clients (Yahoo!, MSN, and AIM), Picasa, browsers and more.
  • All public computers have Deep Freeze Enterprise (which requires unfreezeing/refreezing the computer for the changes to take), Firefox installed.

Now, for the actual instructions…

Step 1: Install basic plug-ins
Go to: https://addons.mozilla.org/en-US/firefox/browse/type:7

Install basic plug-ins for:

  • Acrobat Reader (WITHOUT Adobe Photoshop® Album Starter Edition): This one takes the longest, and requires that Firefox is open when it starts, so do this one first.
  • Flash & Shockwave: both of these require Firefox to be closed, but are fairly quick, so do them second. This will insure that all the crazy web games for kids will work. Do a check by going to the test page on the Adobe site and making sure that the little animations actually work. If the Flash animation isn’t going, click on the puzzle piece to install it. If the Shockwave animation isn’t working, click on the puzzle piece to get to the download of the manual install.

All our machines have Java, Quicktime Alternative, and Real Alternative installed, so we don’t need those plug-ins, but you may need them if you opt for the originals (the latter two are just as well at the real ones, without all the nagware madness and update/app mail notice freakishness).

And, well, Windows XP comes with Windows Media Player.

Step 2: Install & Configure Add-ons
ALL MACHINES:
CuteMenus2
: Iconifies your menus, making them very visual.

REFERENCE KIOSKS ONLY:
Auto Reset Browser: Closes all the windows and open a new browser window after a specified time of inactivity. To change settings go to the Extension Manager (after you restart the browser), click Options (I set the refresh to 600 sec = 10mins).

Step 3: Other Firefox bits to configure

  1. Type about:config into the Firefox address bar (where you would normally type a URL). Type browser.sessionstore.enabled in the bar at the top of the page (not the address bar, but a blank field in the page), and double-click on it to set it to false. Do the same with browser.sessionstore.resume_from_crash. This should keep the browser from spewing a session restore dialog when the machine is restarted (I think this is why Auto Reset Browser tells you to disable Session Restore on the addon page). You can read more about what you can do with about:config file by checking out the knowledge base page on mozillaZine.
  2. Go to View >> Toolbars and uncheck Bookmarks Toolbar to turn that off.
  3. Tools >> Options menu fun (the caps indicate the tab within the options dialog box):
    • MAIN: Save files to My Documents.
    • TABS: New pages should be opened in a new window, to help people who might be confused by opening pages in new tabs.
    • TABS: Uncheck Warn me when closing multiple tabs.
    • CONTENT: Uncheck Block pop-up windows (because some sites require pop-ups, and it’s easier to leave them on than to confuse the user).
    • CONTENT: Click on the Manage… button under File Types. Search Adobe Acrobat, click on Change Action… to set to Open them with the default application (no more .pdf printing confusion from opening within the browser).
    • PRIVACY: Uncheck everything in the History section.
    • PRIVACY: Check everything in the Private Data section and in the Settings button window.
    • SECURITY: Uncheck Remember passwords for sites.

Step 4: Icons
Startup folder: Copy & paste Firefox icon, rename it Internet, delete the Public Web Browser icon. That way, Firefox will open on startup. The home page for the browsers is a web-based “button” interface to help people get around from within the library, because they like the button thing (but it’s not as crazy restrictive as, say, WinU or something like that).

Step 5: Hiding menu stuff
If you want more details on the stuff you can edit using the userChrome.css file, check out the Chrome element names and IDs page on on mozillaZine, as well as this discussion thread on Addons Mirror.

  • Copy userChrome.css (right-click/Ctrl-click to Save as… or drag and drop somewhere) to C:\Documents and Settings\public\Application Data\Mozilla\Firefox\Profiles\xxx.default\chrome (this will only make the change to the “public” user, in this case. You would need to copy this file to each user that you want to affect).
  • The userChrome.css file has code in it to hide specific whole menus and specific menu options, including Option and Add-ons. This is why all that other stuff needs to be done first. However, if you ever need to see these menus, the quick and easy way is to:
    1. Open the userChrome.css file
    2. Comment out (/* at the beginning of the line, */ at the end of the line) the
      • menuitem[label="Options..."], and/or the
      • menuitem[label="Add-ons"],

      lines (respectively, including the comma at the end).

    3. Save the file.
    4. Restart Firefox, and the menus will appear, so you can make your changes. When you’re done, uncomment the lines (delete the /* at the beginning of the line and */ at the end of the line), and save the file. You will need to restart Firefox logged in as the “public” user, in this case, to see the changes.

Here’s a composite image of all the menus in Firefox (click on the image for a larger view). CuteMenus2 makes them nice and visual, which actually helps people a lot.

Hacking Firefox: menu customizations

This is what the full window looks like, with our library start page loaded up.

Hacking Firefox: Full window view

Step 6: Locking down Firefox
Many, many thanks to silentk::cbx3 for his awesome posts — “Security Firefox for schools usage” part 1 and part 2 — for helping me figure this part out! For details on how this works, check out those posts.

The mozilla.cfg file contains stuff you really, really want to lock down. But why do we need this if we did all that other stuff with the options and hiding the menus and whatever? Using the mozilla.cfg file will make it so that even if they figure out how to unhide the menus from Step 5, they can’t actually change anything.

Let’s look at a quick example. You could prevent users from installing more plugins by editing the about:config file (see Step 3, above). However, if you do it that way, the next time the user tries to install a plugin, the browser will show a super-helpful message explaining that the option is disabled, and it will give the user a friendly button to press to re-enable the setting. That’s suboptimal, at best. So, consider this step insurance, especially against those super-industrious nosey users.

There are three parts to this step. Part one is to create a text file which contains the code that locks down specific items. Part two is to do something called byteshifting, so that Firefox can actually read the instructions you set in the text file. While “Security Firefox for schools usage - Part II” notes that byteshifting is unnecessary, the file didn’t work for me on Windows XP without that step. Part three is to tell the browser where to look for the instructions, so it’ll actually do what you tell it to.

Now, in an effort not to give away all of our hacky secrets to, say, the super-industrious Reading patrons ;D, you can download a modified version of our mozilla.cgf file (right click/Ctrl-click the link and Save as…, or drag the link somewhere to save), already byteshifted. Opening the file will just read as garbeldy gook, because it’s all in Mozilla’s crazy moon language. This mozilla.cfg file locks the following settings:

  • Start Page is whatever you set it as in the Firefox Options
  • Browser cache limited at 50mb
  • Disables automatic updates to the browser (So that it won’t harass the user with constant update notices. The Windows permissions on our computers don’t allow for users to install new programs, and with Deep Freeze installed, the updates wouldn’t take, anyway.)
  • Javascript and Java enabled
  • Downloads go to the last folder chosen to save downloads (will default to the folder set in the Options)
  • Keeps users from installing plugins, for serious.

If this satisfies all your wants and desires, then you can skip the next two paragraphs and follow the all.js file instructions that follow.Alternately, if you want to get all sorts of custom with yo bad self, you can check out the very detailed notes in the “Security Firefox for schools usage - Part II” post to make your very own file. If you’ve already gone through all the steps listed here, the bits you’ll need will depend on your library’s configuration. If you want help figuring it out, take a look at that post first and give it a shot, then post questions here as a comment (I can’t make custom files for people, but I can help you figure it out).

Once you have your mozilla.txt file all set, save it in a safe place, just in case you want to change it later. Now, you need to byteshift the file to convert it to a mozilla.cfg file, so that Firefox can actually read and execute your instructions. You can do this by going to the Upload mozilla.txt to get mozilla.cfg (byteshift 13) section of the Automatic Mozilla Configurator home page (about midway down). You will now have a nifty new mozilla.cfg file, which you should copy into the C:\Program Files\Mozilla Firefox\ folder.

Now you need to tell your browser how to find your new instructions.

  1. Make sure that Firefox is CLOSED.
  2. Open the C:\Program Files\Mozilla Firefox\greprefs\all.js in Notepad (double-clicking on this file will likely give you a Javascript error, so be sure to open it from Notepad, and have Notepad show you all file formats instead of just .txt files, then you’ll see it).
  3. Comment out thepref(”general.config.obscure_value”, 13); // for MCD .cfg filesline, so that it ends up looking like//pref(”general.config.obscure_value”, 13); // for MCD .cfg files
  4. Copy this line just below the line from step 2 above pref(”general.config.filename”, “mozilla.cfg”);so that the resulting code looks like this//pref(”general.config.obscure_value”, 13); // for MCD .cfg files
    pref(”general.config.filename”, “mozilla.cfg”);
  5. Save the all.js file and close it.

Easy way to manipulate plug-ins after you install the mozilla.cfg: Comment out the pref(”general.config.filename”, “mozilla.cfg”); line (by adding the // at the beginning of the line), then save. When you’re done, uncomment the line (by deleting the // at the beginning of the line) and save.

If at any point you want to alter the instructions in the mozilla.cfg file, you must make the changes in the mozilla.txt file, then byteshift it, then paste it over the existing file. It’s a lot of steps, so make sure you have what you want before you make it final.

Step 7: Other housekeeping – to do when testing

  • Open Adobe Reader application once, and be sure to check the box that tells Adobe not to show that big screen when it opens.
  • Check Firefox to make sure it works.

So yeah, that’s the long and long of it. Remember that you can play with just parts of these instructions to, say, customize your copy of Firefox on your home computer, or make a snazzy custom browser at work.

Just a note, I’ll be out of town starting Sunday, back on the web officially Tuesday, and I’ll do what I can about answering questions in between. Happy Merry to you all!

Posted in Uncategorized | 8 Comments »

Bad Behavior has blocked 438 access attempts in the last 7 days.