Posts

Firefox - How to set a local file as a homepage?

Jan 12, 2020 | 3 minutes to read

I have my own hand-coded HTML file I use as my home page in all of my browsers. It’s light and loads fast and has all of the links I use on a regular basis. I love it and would hate to live without it. Firefox, though, does not love it, out of the box.

For security reasons, I’m sure, the browser doesn’t allow users to set a local file of any sort as the home page for new tabs. We can set it as the default home page, right in Options > Home screen, but that only applies to when Firefox first starts up and to new windows. And there used to be extensions which could provide this missing feature, but they’ve been made useless with recent Firefox updates (v72 near the end of 2019) so that’s no longer an option.

After much searching, I found this Mozilla Firefox Support page describing the how to make this work. Check it out and follow those steps if you too want to use a local file as your new tab home page.

How do I set my local HTML page as a homepage? (support.mozilla.org)

And just in case that page ever goes away, here are the steps spelled out (and for my own future reference):

  • Create a new text file, somewhere like your Desktop or home folder named, autoconfig.cfg.
  • Enter these lines into that file:

Updated May 16 2020 for Firefox 76. The new browser version broke the older code. This works well for me now.

// first line is a comment
var {classes:Cc,interfaces:Ci,utils:Cu} = Components;
try {
  Cu.import("resource:///modules/AboutNewTab.jsm");
  var newTabURL = "file:///C:/Users/yourname/yourfile.html";
  AboutNewTab.newTabURL = newTabURL;
} catch(e){Cu.reportError(e);} // report errors in the Browser Console
  • Replace “file:///C:/Users/yourname/yourfile.html” with the actual path to your file, something like “file:///homepage.html”, for example.
  • Save that file and then copy it into the root of the Firefox program folder.
  • Create a new text file named autoconfig.js.
  • Enter these lines into that file:
//
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.
  • Disable any tab-related extensions which might change the intended behavior here.
  • Restart Firefox.

And voila! It works (until Mozilla changes something else, at least) Enjoy!


October 18 2022

Danny wrote, “Thank you! Your solution for getting Firefox to open a local file in a new tab worked like a charm. I really appreciate it when people smarter than me share their knowledge.”

You’re welcome but really, I still owe the internet in terms of neat solutions to tough problems. Glad I could help in this case.



You can leave a comment on this post here.