搜尋 Mozilla 技術支援網站

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

Learn More

Can I prevent a user from being able to close the Bookmarks bar?

  • 4 回覆
  • 1 有這個問題
  • 1 次檢視
  • 最近回覆由 cor-el

more options

I have a user who accidentally closes the Firefox Bookmarks bar several times a week. Unfortunately, they cannot remember how to re-pin the Bookmarks bar without help from the technology support team. Is there any way to permanently pin the Bookmarks bar in place, and remove the option for the user to close the Bookmarks bar?

Many thanks!

I have a user who accidentally closes the Firefox Bookmarks bar several times a week. Unfortunately, they cannot remember how to re-pin the Bookmarks bar without help from the technology support team. Is there any way to permanently pin the Bookmarks bar in place, and remove the option for the user to close the Bookmarks bar? Many thanks!

所有回覆 (4)

more options

Hello dwmcbride,

Apart from the obvious (tell that user to be more careful); you could ask them to read (and memorize) how to enable the bookmarks toolbar in this article :

https://support.mozilla.org/en-US/kb/bookmarks-toolbar-display-favorite-websites

Also see :

https://support.mozilla.org/en-US/kb/customize-firefox-controls-buttons-and-toolbars

more options

You can add code to the userChrome.css file below the default @namespace line.


@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#PersonalToolbar {
 max-height: 4em !important;
 min-height: 32px !important;
 visibility: visible !important;
}


It is not that difficult to create userChrome.css if you have never used it.

The first step is to open the "Help -> Troubleshooting Information" page and find the button to access the profile folder.

You can find this button under the "Application Basics" section as "Profile Folder -> Open Folder". If you click this button then you open the profile folder in the Windows File Explorer. You need to create a folder with the name chrome in this folder (name is all lowercase). In the chrome folder you need to create a text file with the name userChrome.css (name is case sensitive). In this userChrome.css text file you paste the text posted.

In Windows saving the file is usually the only time things get more complicated because Windows can silently add a .txt file extension and you end up with a file named userChrome.css.txt. To avoid this you need to make sure to select "All files" in the dialog to save the file in the text editor using "Save File as".

You need to close (Quit/Exit) and restart Firefox when you create or modify the userChrome.css file.

more options

The userChrome.css method keeps the bar visible regardless of whether the user has turned it off or on. That might be most desirable in this case. However, if you did want to afford the user the possibility of hiding the bar, here is an alternative approach.

You could set Firefox to run a script at startup to make sure the bar is visible, regardless of its state at the end of the last session. To run the script, you would create an Autoconfig file. Actually, there would be two files.

For general background, see: Customizing Firefox Using AutoConfig. More specifically:

File #1:

A script file in

[program folder]\defaults\pref

which can be named something like autoconfig.js (or whatever.js). It needs to override sandboxing, so if you are comparing old guidance, that is why there is a third line here:

pref("general.config.filename", "firefox.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);

File #2:

A script file in

[program folder]

which should be named whatever you put on the first line of File #1, but by convention, something like firefox.cfg.

This file will contain privileged script commands to override the user's preference for the Bookmarks Toolbar and guarantee that it is displayed at startup. That doesn't prevent the user from hiding it again.

For example:

// Firefox ignores this first line
// Override possible closure of the Bookmarks Toolbar
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Services.xulStore.setValue(AppConstants.BROWSER_CHROME_URL, "PersonalToolbar", "collapsed", "false");

Note: This is something I came up with in the past hour and while it works in a brief test, I don't have real-world experience with it.

more options

To make the code only work in normal mode and not in full screen mode (i.e. the toolbar is hidden in full screen mode), you can use this code:

#navigator-toolbox:not([inFullscreen]) #PersonalToolbar {
 max-height:4em !important;
 visibility:visible !important;
}