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

搜索 | 用户支持

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

详细了解

.config file

  • 4 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 Mike Kaply

more options

Hello,

I am currently having an issue with Firefox 78.8 not reading .conf file.

i detected that the options bellow are not working now. We had it working with 52.9

Someting changed in the code? What am i missing?


//HM-Popup Exceptions Components.utils.import("resource://gre/modules/Services.jsm"); var uri = Services.io.newURI("http://site.example.net", null, null); Services.perms.add(uri, "popup", 1);


//userchrome and usercontent // const Cc = Components.classes; const Ci = Components.interfaces; Components.utils.import("resource://gre/modules/Services.jsm"); var profileDir = Services.dirsvc.get("ProfD", Ci.nsILocalFile); profileDir.append("chrome"); if( !profileDir.exists() || !profileDir.isDirectory() ) {

 profileDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);

} profileDir.append("userChrome.css"); var fos = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); fos.init(profileDir, -1, -1, false); var css = "#nav-bar { display: none !important; } #toolbar-context-menu {display:none !important;} #TabsToolbar {display:none !important;}"; fos.write(css, css.length); fos.close();

Hello, I am currently having an issue with Firefox 78.8 not reading .conf file. i detected that the options bellow are not working now. We had it working with 52.9 Someting changed in the code? What am i missing? //HM-Popup Exceptions Components.utils.import("resource://gre/modules/Services.jsm"); var uri = Services.io.newURI("http://site.example.net", null, null); Services.perms.add(uri, "popup", 1); //userchrome and usercontent // const Cc = Components.classes; const Ci = Components.interfaces; Components.utils.import("resource://gre/modules/Services.jsm"); var profileDir = Services.dirsvc.get("ProfD", Ci.nsILocalFile); profileDir.append("chrome"); if( !profileDir.exists() || !profileDir.isDirectory() ) { profileDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777); } profileDir.append("userChrome.css"); var fos = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream); fos.init(profileDir, -1, -1, false); var css = "#nav-bar { display: none !important; } #toolbar-context-menu {display:none !important;} #TabsToolbar {display:none !important;}"; fos.write(css, css.length); fos.close();

由t.santos-ext于修改

所有回复 (4)

more options

.....

由t.santos-ext于修改

more options

Check the Javascript console and see if there are any errors.

Changes in Firefox might have caused the script not to work anymore.

more options

If i insert the options above it will prompt:

Failed to read the configuration file. Please contact your system administrator.

For the popup exception i discovered that

This issue is that Services.perms.add no longer works.


Services.perms.addFromPrincipal(
      Services.scriptSecurityManager.createContentPrincipalFromOrigin("http://sriglx"),
      "popup", 1
    );

There's no need do a newURL anymore.

Am i correct?

Regarding the NAV BAR, Toolbar context menu, Tabs bar how can i hide it in the config file?

Can you help me please?

Thank you.

more options

I would recommend you use policies.json for blocking popups and not the autoconfig file.

https://github.com/mozilla/policy-templates/blob/master/README.md

Once you get that problem fixed, your other code for hiding the navbar and other things should still work.