搜索 | 用户支持

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

详细了解

Mozilla Firefox - Manage Bookmarks - Default Folder

  • 7 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 gtadamsesq

more options

Using Firefox version 99.0 (64bit). When I click "Bookmarks / Manage Bookmarks, the listing defaults to the "Other Bookmarks" folder. I would like it to default to the "Bookmarks Menu" folder. How do I make it do that?

Using Firefox version 99.0 (64bit). When I click "Bookmarks / Manage Bookmarks'', the listing defaults to the "Other Bookmarks" folder. I would like it to default to the "Bookmarks Menu" folder. How do I make it do that?

被采纳的解决方案

You can use the autoconfig.cfg file in the Firefox installation folder to initialize (set/lock) preferences and run privileged JavaScript code. In this case code to open the Library with the Bookmarks Menu folder selected. You can modify the showPlaces variable to open any of the four possible root folders (in this case [1]).

To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows and Linux, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located.

The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)

See also:


Content of autoconfig.js

 //
 pref("general.config.filename", "autoconfig.cfg");
 pref("general.config.obscure_value", 0);
 pref("general.config.sandbox_enabled", false); // disable sandbox to allow privileged JavaScript

Content of autoconfig.cfg

// first line in autoconfig.cfg is a comment line
try {
 let {classes:Cc, interfaces:Ci, manager:Cm, utils:Cu} = Components;
 var Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

 function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
 ConfigJS.prototype = {
  observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
  handleEvent: function (aEvent) {
   let document = aEvent.originalTarget;
   let window = document.defaultView;
   let location = window.location;
   if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
    if (window._gBrowser) {
      let showPlaces = ["AllBookmarks","BookmarksMenu","BookmarksToolbar","UnfiledBookmarks"][1];
      elm = document.getElementById("Browser:ShowAllBookmarks");
      if (elm) {
       elm.setAttribute("oncommand", "PlacesCommandHook.showPlacesOrganizer('"+showPlaces+"')");
      }
    }
   }
  }
 };
 if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
} catch(e) {Cu.reportError(e);}
定位到答案原位置 👍 1

所有回复 (7)

more options

See the first few posts in the thread linked below. Evidently some users are now seeing this for the first time (also discussed in that thread).

https://support.mozilla.org/en-US/questions/1370627

more options

Thanks, but that doesn't answer my question.

more options

The archived article "How do I change the default save location for bookmarks back to bookmark menu?" advises installing the "Default Bookmark Folder Option" extension. That Extension works fine for getting a bookmark put at the bottom of the Bookmarks Menu, however, is doesn't make the "Bookmarks Menu " folder the default menu folder for SEARCHING bookmarks. When I click "Bookmarks / Manage Bookmarks" it still defaults to the "Other Bookmarks" folder. How do I make clicking "Bookmarks / Manage Bookmarks" default to the "Bookmarks Menu" folder?

more options

You can look for an extension like this on the Add-ons website.

more options

As I mentioned in my post, the "Default Bookmark Folder" Add On does not solve my stated problem.

more options

选择的解决方案

You can use the autoconfig.cfg file in the Firefox installation folder to initialize (set/lock) preferences and run privileged JavaScript code. In this case code to open the Library with the Bookmarks Menu folder selected. You can modify the showPlaces variable to open any of the four possible root folders (in this case [1]).

To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows and Linux, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located.

The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)

See also:


Content of autoconfig.js

 //
 pref("general.config.filename", "autoconfig.cfg");
 pref("general.config.obscure_value", 0);
 pref("general.config.sandbox_enabled", false); // disable sandbox to allow privileged JavaScript

Content of autoconfig.cfg

// first line in autoconfig.cfg is a comment line
try {
 let {classes:Cc, interfaces:Ci, manager:Cm, utils:Cu} = Components;
 var Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

 function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
 ConfigJS.prototype = {
  observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
  handleEvent: function (aEvent) {
   let document = aEvent.originalTarget;
   let window = document.defaultView;
   let location = window.location;
   if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
    if (window._gBrowser) {
      let showPlaces = ["AllBookmarks","BookmarksMenu","BookmarksToolbar","UnfiledBookmarks"][1];
      elm = document.getElementById("Browser:ShowAllBookmarks");
      if (elm) {
       elm.setAttribute("oncommand", "PlacesCommandHook.showPlacesOrganizer('"+showPlaces+"')");
      }
    }
   }
  }
 };
 if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
} catch(e) {Cu.reportError(e);}

由cor-el于修改

more options

Thank you, thank you, thank you for a solution that seriously worked well.

For those with the same problem, but don't understand the details on how to create or place the required files, here are the steps:

1. Shut down Firefox if you have it running.

2. Open a plain text compiler such as EditPad Lite 8, available from https://www.editpadlite.com

3. Create a new blank text file

4. Copy and paste the following into the new file (do not add anything else):

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false); // disable sandbox to allow privileged JavaScript

5.. Save the file as autoconfig.js and put the file in the C:/Program Files/Mozilla Firefox/defaults/pref folder

6. Create a new blank text file

7. Copy and paste the following into the new file (do not add anything else):

// first line in autoconfig.cfg is a comment line try {

let {classes:Cc, interfaces:Ci, manager:Cm, utils:Cu} = Components;
const {Services} = Cu.import('resource://gre/modules/Services.jsm');
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
 observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
 handleEvent: function (aEvent) {
  let document = aEvent.originalTarget;
  let window = document.defaultView;
  let location = window.location;
  if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
   if (window._gBrowser) {
     let showPlaces = ["AllBookmarks","BookmarksMenu","BookmarksToolbar","UnfiledBookmarks"][1];
     elm = document.getElementById("Browser:ShowAllBookmarks");
     if (elm) {
      elm.setAttribute("oncommand", "PlacesCommandHook.showPlacesOrganizer('"+showPlaces+"')");
     }
   }
  }
 }
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }

} catch(e) {Cu.reportError(e);}

8. Save the file as autoconfig.cfg and put the file in the C:/Program Files/Mozilla Firefox folder

9. Restart Firefox, click Bookmarks / Manage Bookmarks, and it will default to the Bookmarks Menu