搜尋 Mozilla 技術支援網站

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

了解更多

I want to open new tabs in a local page

  • 9 回覆
  • 3 有這個問題
  • 1 次檢視
  • 最近回覆由 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?