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.
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.
Now you’re going to want to edit the auto configuration for firefox.
# sudo nano /usr/lib/firefox/defaults/pref/autoconfig.js
- 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);
Exit and save the file.
Now, we’re going to edit the ‘autoconfig.cfg’ file we referenced above.
# sudo nano /usr/lib/firefox/autoconfig.cfg
- 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
- 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
- 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
Exit and save your file.
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.
Rejoice!