X
Tap here to go to the mobile version of the site.

Support Forum

How do I set my local HTML page as a homepage?

Posted

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.

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.

Chosen solution

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);
Read this answer in context 1
Quote

Additional System Details

Installed Plug-ins

  • Shockwave Flash 32.0 r0

Application

  • User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0

More Information

WestEnd
  • Top 10 Contributor
60 solutions 5190 answers

Go to your settings and in there you can make whatever url your homepage.

Go to your settings and in there you can make whatever url your homepage.
Was this helpful to you? 0
Quote

Question owner

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).

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).
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17172 solutions 155209 answers

Helpful Reply

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)

You can use an autoconfig.cfg file to set the new tab page. This also works with a local page for me. *https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig ---- <pre><nowiki>// 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; </nowiki></pre> ---- You can use the <u>autoconfig.cfg</u> 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 <u>autoconfig.js</u> 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: *https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig ''(edited to add the sandbox pref to autoconfig.js)''

Modified by cor-el

Was this helpful to you? 1
Quote

Question owner

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.

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.
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17172 solutions 155209 answers

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.

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.
Was this helpful to you?
Quote

Question owner

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).

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).
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17172 solutions 155209 answers

Did you replace the about:blank value with the URL of your desired new tab page?

  • var newTabURL = "file:///...";
Did you replace the about:blank value with the URL of your desired new tab page? * var newTabURL = "file:///...";
Was this helpful to you?
Quote

Question owner

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.

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.
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17172 solutions 155209 answers

You will have to disable the My Homepage extension that is controlling the new tab page as you can see in the third screenshot.

You will have to disable the My Homepage extension that is controlling the new tab page as you can see in the third screenshot.
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17172 solutions 155209 answers

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?

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?

Modified by cor-el

Was this helpful to you?
Quote

Question owner

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.

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.
Was this helpful to you?
Quote
cor-el
  • Top 10 Contributor
  • Moderator
17172 solutions 155209 answers

Chosen Solution

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);
OK, I see what is wrong. You need to add a third line to the autoconfig.js file. <pre><nowiki>// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false); </nowiki></pre>
Was this helpful to you? 1
Quote

Question owner

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. ;-)

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. ;-)
Was this helpful to you?
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.