Change New Tab in Firefox
I’ve started ricing my workstation again and wanted to change the new tab page in Firefox. Apparently it’s harder than it should be because extensions don’t have access to an API that can do it. You might remember a setting called “New Tabs” but it only let you choose between a blank page and the default new tab page.
Anyway, the solution is to edit the internal new tab service through the browser console. If you don’t want to run the script every time you launch Firefox you can configure it to auto run with an autoconfig.js file.
Put the script with the name firefox.cfg in the Firefox directory (/usr/lib64/firefox) and the script itself with the name autoconfig.js in the preferences directory (/usr/lib64/firefox/browser/defaults/preferences).
It should be noted that this solution would set the new tab for all users and not only you.
firefox.cfg
// IMPORTANT: Start your code on the 2nd line
try {
Components.classes["@mozilla.org/browser/aboutnewtab-service;1"]
.getService(Components.interfaces.nsIAboutNewTabService)
.newTabURL = "file:///path/to/index.html";
} catch(e){
console.log(e);
}
autoconfig.js
pref("general.config.filename", "firefox.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);