MozillaZine

User.js file

From MozillaZine Knowledge Base

(Difference between revisions)
Revision as of 14:33, 4 January 2006
Alice Wyman (Talk | contribs)
(Changing user.js entries - added prefs.js file link)
<-- Previous diff
Revision as of 17:07, 4 January 2006
Mozcerize (Talk | contribs)
(added links to the chromEdit extension)
Next diff -->
Line 1: Line 1:
{{wrongtitle|title=user.js file}} {{wrongtitle|title=user.js file}}
-The ''user.js'' file, located in the [[profile folder]], is used to customize preference settings in Mozilla-based programs. Since the user.js file does not exist by default, you'll need to create the file before you can start adding your preferences. When you launch the application, the valid preferences you've added to user.js are then automatically copied into the [[prefs.js file]] (also located in the same profile folder), which stores all the preferences for the current user. For that reason, before you create or edit the user.js file it is advisable to make a backup copy of the prefs.js file. Although the prefs.js file can be modified using ([[about:config]]) or through the options and preference settings within the Firefox/Thunderbird/Mozilla Suite program's user-interface, the preferences you add via the ''user.js'' file will '''never''' be modified unless you yourself edit the user.js file contents.+The ''user.js'' file, located in the [[profile folder]], is used to customize preference settings in Mozilla-based programs. When you launch the application, the valid preferences you've added to user.js are then automatically copied into the [[prefs.js file]] (also located in the same profile folder), which stores all the preferences for the current user. For that reason, before you create or edit the user.js file it is advisable to make a backup copy of the prefs.js file. Although the prefs.js file can be modified using ([[about:config]]) or through the options and preference settings within the Firefox/Thunderbird/Mozilla Suite program's user-interface, the preferences you add via the ''user.js'' file will '''never''' be modified unless you yourself edit the user.js file contents.
== Creating the user.js file== == Creating the user.js file==
-If ''user.js'' does not exist in your [[profile folder]], create it by opening Notepad or another text editor, type in the preference entries (and any comments) then save the file as "user.js". (On Windows OS, make sure you UNhide extensions for known filetypes in Folder Options, so that the file isn't really called "user.js.txt".) +The user.js file does not exist by default, and so you'll need to create the file before you can start adding your preferences. Either use the [https://addons.mozilla.org/extensions/moreinfo.php?id=17 ChromEdit] extension, or open Notepad or another text editor, type in the preference entries (and any comments) then save the file as "user.js" inside your [[profile folder]]. (On Windows OS, make sure you UNhide extensions for known filetypes in Folder Options, so that the file isn't really called "user.js.txt".)
Valid preferences are entered via the user_pref command, as demonstrated below. '''//''' denotes a comment, so anything after these two characters on a line is ignored. A valid preference entry always begins with ''user_pref'' and always ends with a semi-colon; every preference must be entered on a new line. In Windows, if the preference value specifies a folder path, the path separator must be two backslashes. Valid preferences are entered via the user_pref command, as demonstrated below. '''//''' denotes a comment, so anything after these two characters on a line is ignored. A valid preference entry always begins with ''user_pref'' and always ends with a semi-colon; every preference must be entered on a new line. In Windows, if the preference value specifies a folder path, the path separator must be two backslashes.
Line 16: Line 16:
==Changing user.js entries == ==Changing user.js entries ==
-To edit user.js, open it within your text editor, make your changes, then close the file and save the changes. +To edit user.js, either use the [https://addons.mozilla.org/extensions/moreinfo.php?id=17 ChromEdit] extension, or open the file in a text editor such as Notepad, make your changes, then close the file and save the changes.
To undo preferences that have been set in the ''user.js'' file: To undo preferences that have been set in the ''user.js'' file:

Revision as of 17:07, 4 January 2006

The user.js file, located in the profile folder, is used to customize preference settings in Mozilla-based programs. When you launch the application, the valid preferences you've added to user.js are then automatically copied into the prefs.js file (also located in the same profile folder), which stores all the preferences for the current user. For that reason, before you create or edit the user.js file it is advisable to make a backup copy of the prefs.js file. Although the prefs.js file can be modified using (about:config) or through the options and preference settings within the Firefox/Thunderbird/Mozilla Suite program's user-interface, the preferences you add via the user.js file will never be modified unless you yourself edit the user.js file contents.

Creating the user.js file

The user.js file does not exist by default, and so you'll need to create the file before you can start adding your preferences. Either use the ChromEdit extension, or open Notepad or another text editor, type in the preference entries (and any comments) then save the file as "user.js" inside your profile folder. (On Windows OS, make sure you UNhide extensions for known filetypes in Folder Options, so that the file isn't really called "user.js.txt".)

Valid preferences are entered via the user_pref command, as demonstrated below. // denotes a comment, so anything after these two characters on a line is ignored. A valid preference entry always begins with user_pref and always ends with a semi-colon; every preference must be entered on a new line. In Windows, if the preference value specifies a folder path, the path separator must be two backslashes.

// relocate parent directory for browser cache
user_pref("browser.cache.disk.parent_directory", "D:\\Mozilla\\Firefox\\"); 
// relocate or share the browser bookmarks file
user_pref("browser.bookmarks.file", "D:\\Mozilla\\Firefox\\bookmarks.html");

For a list of valid preferences, consult the about:config entries article.

Changing user.js entries

To edit user.js, either use the ChromEdit extension, or open the file in a text editor such as Notepad, make your changes, then close the file and save the changes.

To undo preferences that have been set in the user.js file:

  1. Remove the unwanted preference entries fom the user.js file as a first step. However, since the same preference is now written to the prefs.js file, a second step is needed:
  2. Also remove the preference entries from prefs.js, either by direct editing of the prefs.js file (not recommended) or by resetting the preference via about:config.

External links