![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
How do I set my local HTML page as a homepage?
Hi,
I like having my local HTML file as a homepage which gives me links to my favourite sites. However, Firefox doesn't seem to support loading a local homepage in a new tab. I have attempted to resolve this by setting up a server and using the My Homepage addon which kind of workds, but it's extremely slow and cumbersome.
Would be very grateful if someone had a better idea.
Избрано решение
OK, I see what is wrong.
You need to add a third line to the autoconfig.js file.
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);Прочетете този отговор в контекста 👍 1
Всички отговори (13)
Go to your settings and in there you can make whatever url your homepage.
Unfortunately, this exactly does not work with a local file. I want my homepage to be shown every time I open a new tab, but that doesn't work with a local address (file://address), only with a remote one (http://address).
You can use an autoconfig.cfg file to set the new tab page. This also works with a local page for me.
// first line is a comment var {classes:Cc,interfaces:Ci,utils:Cu} = Components; var newTabURL = "about:blank"; aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService); aboutNewTabService.newTabURL = newTabURL;
You can use the autoconfig.cfg file in the Firefox program folder to initialize (set/lock) preferences.
The autoconfig.cfg file needs to be in the main Firefox program folder.
This requires a autoconfig.js file in the "defaults/pref" folder where the channel-prefs.js file is located that specifies to use autoconfig.cfg.
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);
The autoconfig.cfg and autoconfig.js files need to start with a comment line (//).
See also:
(edited to add the sandbox pref to autoconfig.js)
Променено на
Thanks for your reply, however, it doesn't seem to have worked. I added the two files into the relevant folders (/usr/lib/firefox/autoconfig.cfg and /usr/lib/firefox/defaults/pref/autoconfig.js, but sadly nothing has changed after restarting Firefox.
Sorry, I noticed that I made an error in the autoconfig.cfg file while pasting my own code.
Components["@mozilla.org/browser/aboutnewtab-service;1"] should be Components.classes["@mozilla.org/browser/aboutnewtab-service;1"]
I corrected the above posted code and tested it this time.
Thanks cor-el, but sadly this hasn't worked either. I get a blank page every time I open a new tab and have to manually click on the home button to get me to the homepage. I am still using the My Homepage addon, but there must be something which prevents it from accessing my local homepage.
I have also tried disabling the My Homepage addon, but that doesn't work at all as I end up on Firefox Home (the page with links to sites I recently visited).
Did you replace the about:blank value with the URL of your desired new tab page?
- var newTabURL = "file:///...";
Yes, I did. It still doesn't change anything. I uploaded two screenshots to show you the current settings with the two created files and one to show what happens when I open a new tab.
You will have to disable the My Homepage extension that is controlling the new tab page as you can see in the third screenshot.
Are you sure that /usr/lib/firefox is the correct directory because Firefox would normally display a message at the top of the about:preferences page that an autoconfig file is active?
Променено на
When I disable the addon a new tab shows the Firefox Home (the page with links to sites I recently visited).
I am not sure if it is in the right directory, however, I can show you a screenshot of my web console if it makes any sense to you.
Избрано решение
OK, I see what is wrong.
You need to add a third line to the autoconfig.js file.
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);
Thank you, cor-el! That works great! You've made my day, I am ever so obliged! I'll think of you every time I open a new tab. ;-)