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

منتدى الدعم

I want to open new tabs in a local page

Posted

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?

Chosen solution

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.

Read this answer in context 0

Additional System Details

Installed Plug-ins

  • Shockwave Flash 29.0 r0

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0

More Information

cor-el
  • Top 10 Contributor
  • Moderator
16703 solutions 151076 answers

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
If you can't do this with an extension then you can use a mozilla.cfg file in the Firefox program folder. See Configuration: *https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment Enterprise_deployment_before_60 See also: *http://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/ ----- You can use the <u>mozilla.cfg</u> 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 <u>local-settings.js</u> 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. ---- <pre><nowiki>// 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 </nowiki></pre>

Helpful Reply

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.

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.

Chosen Solution

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.

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.
cor-el
  • Top 10 Contributor
  • Moderator
16703 solutions 151076 answers

Helpful Reply

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.

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.
cjcoats 0 solutions 2 answers

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

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...
cor-el
  • Top 10 Contributor
  • Moderator
16703 solutions 151076 answers

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

See also:

Code in mozilla.cfg in the Firefox installation folder works for all users that start this specific Firefox version. See also: *https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment_before_60
cjcoats 0 solutions 2 answers

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?

''cor-el [[#answer-1108341|said]]'' <blockquote> Code in mozilla.cfg in the Firefox installation folder works for all users that start this specific Firefox version. See also: *https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment_before_60 </blockquote> 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?
cor-el
  • Top 10 Contributor
  • Moderator
16703 solutions 151076 answers

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.

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.
jamied_uk 0 solutions 2 answers

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?

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?