Recently I set out to customize my Firefox a little bit. I found this awesome Start Page thanks to /r/startpages which you can download here.

Upon setting it up, and customizing it I realized the old method of userChrome.js doesn’t seem to work anymore for opening a local HTML file in a new tab. Annoying.

After a little research, I’ve figured it out and documented it for anyone else running into this. Note this is specific to ArchLinux, but I’m sure it’s similar on other Linux distributions.

  1. After using the instructions to setup the custom css, and, start page from here. Make sure the CSS and start page work fine on ’new windows’ opening. Then, and only then, continue on to the rest.

  2. Now you’re going to want to edit the auto configuration for firefox.

# sudo nano /usr/lib/firefox/defaults/pref/autoconfig.js 
  1. In this file, paste the following contents. Note the first line is important to leave there from what I’ve read.
// IMPORTANT, LEAVE THIS HERE
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);
  1. Exit and save the file.

  2. Now, we’re going to edit the ‘autoconfig.cfg’ file we referenced above.

# sudo nano /usr/lib/firefox/autoconfig.cfg
  1. Put the following contents in there.
// IMPORTANT: Start your code on the 2nd line
var home = getenv("HOME");
lockPref("autoadmin.global_config_url", "file:" + home + "/.mozilla/firefox/user.js");
var {classes:Cc,interfaces:Ci,utils:Cu} = Components;
try {
  Cu.import("resource:///modules/AboutNewTab.jsm");
  var newTabURL = "#########################################################";
  AboutNewTab.newTabURL = newTabURL;
} catch(e){Cu.reportError(e);} // report errors in the Browser Console
  1. Edit the ’newTabURL’ line to replace the ########## with your actual path. Something like this;
file:///home/yourusername/.mozilla/firefox/b3c3dhde.default-release/startpage_alt/index.html
  1. This means your file should look like this;
// IMPORTANT: Start your code on the 2nd line
var home = getenv("HOME");
lockPref("autoadmin.global_config_url", "file:" + home + "/.mozilla/firefox/user.js");
var {classes:Cc,interfaces:Ci,utils:Cu} = Components;
try {
  Cu.import("resource:///modules/AboutNewTab.jsm");
  var newTabURL = "file:///home/yourusername/.mozilla/firefox/b3c3dhde.default-release/startpage_alt/index.html";
  AboutNewTab.newTabURL = newTabURL;
} catch(e){Cu.reportError(e);} // report errors in the Browser Console
  1. Exit and save your file.

  2. Close and restart firefox. The new window should show the start page (you already verified this right??). Now try opening a new tab, and it should open your start page as well.

  3. Rejoice!