Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

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

  • 9 个回答
  • 0 人有此问题
  • 1 次查看
  • 最后回复者为 citizen1138x

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.