搜尋 Mozilla 技術支援網站

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

Learn More

Mozilla Firefox - Manage Bookmarks - Default Folder

  • 7 回覆
  • 1 有這個問題
  • 42 次檢視
  • 最近回覆由 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;
 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);}
從原來的回覆中察看解決方案 👍 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;
 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);}

由 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

有幫助嗎?

問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題