Posts

A while ago, I wrote a post about how to setup Firefox on Windows so it will auto-load a text file into every new tab / window. That works really well for Windows OS but I recently built a new PC based on the Intel NUC and at the same time, I switched to using Ubuntu for my OS. The steps for making this same change in Firefox for Linux are very similar to those I wrote down before, but they’re different enough that I think they warrant a separate post. So, here we go.

For starters, I am working on Ubuntu 20.04 LTS, and I am assuming you are logged into your Linux OS with a non-Root account. Firefox will not let you add files to its program folders, when you’re not the root user. If you’re using a similar OS / user, you will probably need to add “sudo” in front of your file copy commands below, like I am showing below for the copy (‘cp’) commands.

  • Create a new text file, somewhere like your home folder named, autoconfig.cfg.

    cd ~

    nano ./autoconfig.cfg

  • Enter these lines into that file:

This is working for me as of July 2021, on Firefox 89 but we never know if they will change how this works later on…

// first line is a comment
var {classes:Cc,interfaces:Ci,utils:Cu} = Components;
try {
  Cu.import("resource:///modules/AboutNewTab.jsm");
  var newTabURL = "file:///home/username/yourfile.html";
  AboutNewTab.newTabURL = newTabURL;
} catch(e){Cu.reportError(e);} // report errors in the Browser Console
  • Replace “file:///home/username/yourfile.html” with the actual path to your file, something like “file:///home/username/web/homepage.html”, for example.

  • Save that file and then copy it into the root of the Firefox program folder. For me that is at /usr/lib/firefox.

    sudo cp ./autoconfig.cfg /usr/lib/firefox

  • Create a new text file named autoconfig.js.

    nano ./autoconfig.js

  • Enter these lines into that file:

// first line is a comment
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);
  • Save that file and then copy it into the defaults/pref folder under ther Firefox program folder. For me that is at, /usr/lib/firefox/defaults/pref.

    sudo cp ./autoconfig.js /usr/lib/firefox/defaults/pref

  • Disable any tab-related extensions which might change the intended behavior here.

  • Restart Firefox.

And voilĂ ! When you open a new tab in Firefox, your static file should be automagically loaded (until Mozilla changes something else, at least.) Enjoy!


You can leave a comment on this post here.