為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Blank new tab when using file:/// for homepage with newtabhomepage addon

more options

A Client recently dumped their Windows server. They ran IIS and had an Intranet website. The website has been static for years and I have set up a method for the tech person there to propagate changes without having to visit each PC, should the need arise.

The browsers were all running NewTabHomepage so that when a new tab was opened the homepage from the website was displayed. They do not want an external website as their homepage as the internal one has links to a bunch of stuff they use all day.

When the homepage in Firefox is set to open a page via file:/// rather than http:// when a new tab is opened the homepage is not loaded. A blank page is displayed.

Is there a way around this?

A Client recently dumped their Windows server. They ran IIS and had an Intranet website. The website has been static for years and I have set up a method for the tech person there to propagate changes without having to visit each PC, should the need arise. The browsers were all running NewTabHomepage so that when a new tab was opened the homepage from the website was displayed. They do not want an external website as their homepage as the internal one has links to a bunch of stuff they use all day. When the homepage in Firefox is set to open a page via file:/// rather than http:// when a new tab is opened the homepage is not loaded. A blank page is displayed. Is there a way around this?

由 citizen1138x 於 修改

被選擇的解決方法

You can check the Browser Console for more detail about what is wrong with the autoconfig.cfg file. The autoconfig.cfg file needs to be in the same location as the Firefox.exe executable.

You can open open the file in a Firefox tab to get the correct file:/// URI. Note that this is one line to remind that you need to dissble the sandbox via autoconfig.js // autoconfig.cfg start with a comment line; autoconfig.js => pref("general.config.sandbox_enabled", false);


To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)
從原來的回覆中察看解決方案 👍 0

所有回覆 (9)

more options

You can't use an extension like NTO to set the new tab page to a local page, you would have to use an autoconfig.cfg file. NTO can store a copy of a local file in its extension data storage. https://addons.mozilla.org/firefox/addon/new-tab-override/

  • Store a local HTML file in the extension and use it for new tab content

// autoconfig.cfg start with a comment line; autoconfig.js => pref("general.config.sandbox_enabled", false);
try {
  Components.utils.import("resource:///modules/AboutNewTab.jsm");
  AboutNewTab.newTabURL = "file://xxx";
} catch(e){Components.utils.reportError(e);} // Browser Console

The content of autoconfig.js:

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);
more options

Ok see if I got this right;

1. Remove newtabhomepage 2. Install newtaboverride 3. Create file autoconfig.cfg in C:\Program Files\Mozilla Firefox\defaults\pref 4. Create file autoconfig.js in C:\Program Files\Mozilla Firefox 5. Set the AboutNewTab.newTabURL = "<path to file>"; in autoconfig.cfg where <path to file> is the URL currently defined in Firefox as the homepage.

Also, I notice that in your example you say file://. The URL in Firefox has file:/// (three slashes). What is the extra slash for?

I will let you know how it goes. thanks

more options

If you want to go for the autoconfig.cfg option then you do not need the NTO extension. NTO is suited for setting the new tab page to an internet page, but is less suited for a local page as it stores a copy of the HTML page. The home page you can set to any page via Settings and about:config, but for the new tab page there is only a blank page or the Firefox Home page where you can hide/show various content.

more options

Ok, now I'm confused.

So I don't need any extension whatsoever?

I can use autoconfig and get the result I want with the local page. Am I understanding correctly?

more options

Yes, using autoconfig.js and autoconfig.cfg is sufficient.

more options

I asked the person to place the two files as mentioned above. He says he has placed them correctly (I asked him to confirm twice) and he gets this error...

more options

選擇的解決方法

You can check the Browser Console for more detail about what is wrong with the autoconfig.cfg file. The autoconfig.cfg file needs to be in the same location as the Firefox.exe executable.

You can open open the file in a Firefox tab to get the correct file:/// URI. Note that this is one line to remind that you need to dissble the sandbox via autoconfig.js // autoconfig.cfg start with a comment line; autoconfig.js => pref("general.config.sandbox_enabled", false);


To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)
more options

From am earlier post...

3. Create file autoconfig.cfg in C:\Program Files\Mozilla Firefox\defaults\pref 4. Create file autoconfig.js in C:\Program Files\Mozilla Firefox

Whoa! Wrong way around. No wonder. I've set up a PC here to mirror his so I'll test from here. Will get back to you.

more options

Ok, tested here on a spare PC and it works perfectly. thanks for your help.