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

搜索 | 用户支持

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

详细了解

I want to open new tabs in a local page

  • 9 个回答
  • 3 人有此问题
  • 109 次查看
  • 最后回复者为 Jay

more options

I want my new tabs in Firefox Quantum to open to my home page. My home page is a local page with all of my frequently used links on it. I've tried using New Tab Homepage and New Tab Override, and neither of them gives me what I want. I can easily do this with EVERY OTHER BROWSER I use; why not Firefox?

I want my new tabs in Firefox Quantum to open to my home page. My home page is a local page with all of my frequently used links on it. I've tried using New Tab Homepage and New Tab Override, and neither of them gives me what I want. I can easily do this with EVERY OTHER BROWSER I use; why not Firefox?

被采纳的解决方案

I'm afraid that the cut-and-paste from your other post was missing a line of code. The complete code looks like this:

// mozilla.cfg needs to start with a comment line var {classes:Cc,interfaces:Ci,utils:Cu} = Components; /* set new tab page */ try {

 var newTabURL = "file:///C:/Users/<path_to_file>";
 aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService);
 aboutNewTabService.newTabURL = newTabURL;

} catch(e){Cu.reportError(e);} // report errors in the Browser Console


This works, thank you very much. Thanks also to my friend OrangeRider who found the error and fixed this.

定位到答案原位置 👍 0

所有回复 (9)

more options

If you can't do this with an extension then you can use a mozilla.cfg file in the Firefox program folder.

See Configuration:

See also:


You can use the mozilla.cfg file in the Firefox program folder to initialize (set/lock) preferences and run privileged JavaScript code.

The mozilla.cfg file needs to be in the main Firefox program folder

This requires a local-settings.js file in the "defaults/pref" folder where the channel-prefs.js file is located that specifies to use mozilla.cfg.

//
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);

The mozilla.cfg and local-settings.js files need to start with a comment line (//).

You can open the local file in a tab to get the correct URL to use in the newTabURL variable.


// mozilla.cfg needs to start with a comment line

/* set new tab page */
try {
  var newTabURL = "file://";
  aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService);
  aboutNewTabService.newTabURL = newTabURL;
} catch(e){Cu.reportError(e);} // report errors in the Browser Console
more options

Thank you for the quick reply. I'm afraid that these articles are way out of my depth; I can barely spell javaScript. I'm going to see if one of my friends can help me with this and I'll post here once I have results.

more options

选择的解决方案

I'm afraid that the cut-and-paste from your other post was missing a line of code. The complete code looks like this:

// mozilla.cfg needs to start with a comment line var {classes:Cc,interfaces:Ci,utils:Cu} = Components; /* set new tab page */ try {

 var newTabURL = "file:///C:/Users/<path_to_file>";
 aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService);
 aboutNewTabService.newTabURL = newTabURL;

} catch(e){Cu.reportError(e);} // report errors in the Browser Console


This works, thank you very much. Thanks also to my friend OrangeRider who found the error and fixed this.

more options

Sorry. I forgot to add the var {classes:Cc,interfaces:Ci,utils:Cu} = Components; line that is at the start of my mozilla.cfg file when I copied the new tab section further down.

more options

This sets the new-tab page for all users on the whole machine. What about the case when it's multi-user? ...and what about permissions in a multi-user environment -- do you expect all users to be able to fiddle with /usr/lib64?

In particular, when I do "ls -1 /nas/longleaf/home/ | wc -l" I get 1315 users...

more options

Code in mozilla.cfg in the Firefox installation folder works for all users that start this specific Firefox version.

See also:

more options

cor-el said

Code in mozilla.cfg in the Firefox installation folder works for all users that start this specific Firefox version. See also:

Does not help the issue: ordinary users on a Linux server do not have the access permissions necessary to do that for their own firefox session. And if they did, why should one user be allowed to clobber another?

more options

A user who would want to modify settings via mozilla.cfg would have to install Firefox in a folder in their home directory to have write permission and make the change only for their Firefox installation.

more options

I cant find mozilla.cfg and i need the new tab to open my local file, i am the only user no security risk at all, why dont you allow override or put a password on this so noone but me can change that setting if thats all that worries you? i cant stand blank pages or cheasy pages made by browsers i like my own the new browser is also not working right with iframes on local pages either its now trying ips that dont exist on my network why cant you stop taking out features i use and then claim its better than before!!! i need the last version that worked with new tabs for local files or put this feature in!!! help me i cant remember which version i had why cant you have a downgrade button and also say on the browser options the previous installed version?