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

Support Forum

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
Quote

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
16155 solutions 145774 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>
Was this helpful to you? 0
Quote

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.
Was this helpful to you? 1
Quote

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.
Was this helpful to you? 0
Quote
cor-el
  • Top 10 Contributor
  • Moderator
16155 solutions 145774 answers

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.
Was this helpful to you?
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.