Chapter 6. Power Firefox Tricks and Techniques

All right, everyone keep their hands off the computer and no one gets hurt!” How many times have you felt that the program’s developers don’t want you to do any customization? How many times has a program been great, except for those two or three things that make it more difficult for you? Have you wondered if it might be possible to improve the performance of an application? Well, this chapter is for you: It is time to learn to spiff up and add nitrous to Firefox!

Finding Your Configuration Files

Two types of configuration files, user profile configuration files and Firefox configuration files, are found in the Firefox installation folder located in C:Program FilesMozilla Firefox.

In Windows, Firefox is installed in the folder designated by the environment variable %programfiles%. When the Firefox installation folder or the installation folder is mentioned, you are being referred to C:Program FilesMozilla Firefox. Throughout this chapter, it is assumed that your programs are installed in this particular folder. If yours is different, substitute your folder location as appropriate.

Found in the Firefox installation folder is a number of subfolders and files that Firefox uses. Three of these are significant:

  • Defaults.ini and components.iniThese files are used to configure Firefox. They contain only a minimal amount of information indicating to Firefox that there are no extra configuration files.

  • Defaults—A folder that holds default configuration information.

Specific configuration files in different operating systems are discussed next.

Windows XP and 2000

Both Windows XP and Windows 2000 use a similar hierarchy to manage documents for multiple users. Each user has a set of folders located in the folder C:Documents and Settings. Under this folder is a folder specific to each user (named with the user’s logon name), another folder used to create a new user’s profile when users log on for the first time (named Default User), and a folder shared by all logged on users (named All Users). The user’s profile location is referred to as user profile folder.

Note

User profile files may be found in different locations based on which version of Windows is being used. Most users today are using Windows XP, although there are some Windows 2000, Windows 98, and Windows Me installations. There are few, if any, Windows 95 installations using Firefox.

Neither the Default User folder nor the All Users folder has a My Documents folder, but both are configured with an Application Data folder. You can place configurations for Firefox in the Application Data folders. I recommend that the Default User folder have a standardized copy of the Firefox configuration and profile folders. This folder could be copied to the All Users folder, too; however, this is probably not necessary or desirable.

Note

To access hidden folders, do the following:

In Explorer, select Tools, Folder Options in the menu. Click the View tab, and check Show Hidden Files and Folders under the Hidden Files and Folders category. Also check Display the Contents of System Folders if you want. In a command prompt (cmd.exe), use the dir command’s option /ah (show hidden files) to display all hidden folders and files. A command prompt command works with hidden folders and files even if you can’t see them. (That is, if you type cd "Application Data", the current folder is Application Data, even if Application Data is hidden.) You can also turn off the hidden attribute for hidden folders and files. This is legitimate, although not really recommended.

The default profile information for a user is contained in the user’s Documents and Settings folder, under Application DataMozillaFirefoxProfilesxxxxxxxx.default (xxxxxxxx is a string of random numbers and letters). Figure 6.1 shows the directory hierarchy for a typical Firefox profile installation. In this figure the default profile is named xrjy2cro.default. Either a command prompt or Explorer may be used to view these files. Be aware that the Application Data folder is a hidden folder.

The location for a typical default profile is shown for the user named Administrator.

Figure 6.1. The location for a typical default profile is shown for the user named Administrator.

Windows 95, 98, and Millennium

On the earlier 16/32 bit versions of Windows (such as Windows 95, Windows 98, and Windows Me), there is no true support for multiple users. All users share the same configuration, desktop, My Documents, and other user objects.

In these operating systems, the path to the profile is C:WINDOWSApplication DataMozillaFirefoxProfilesxxxxxxxx.default (assuming that Windows is installed in the C:WINDOWS folder). xxxxxxxx is a string of random numbers and letters. The previous note on hidden files might be applicable in some installations.

Mac

On Mac OS X (which is the only Macintosh operating system supported by current Mozilla and Firefox versions) the path to a user’s profile is frequently ~/Library/Application Support/Firefox/Profiles/xxxxxxxx.default/ (xxxxxxxx is a string of random numbers and letters). The profile holds similar files as a Windows installation of Firefox.

Linux

For most Linux installations, user profiles are stored in ~/.mozilla/firefox/xxxxxxxx.default/ for most installations. (xxxxxxxx is a string of random numbers and letters.) The profile holds similar files as a Windows installation of Firefox.

Firefox Global Preferences and Properties

Firefox is the ultimate in flexible programs. It is possible to almost completely reconfigure Firefox for users specifically (actually user profiles; a user might have several Firefox configurations). Firefox is also able to set preferences for all users, globally. Settings in either the local or global location produce the same effects. Global settings affect all users and local settings affect only that user profile. With global settings, it is also possible to change settings that would be applied to a newly created user profile.

Global Preferences

Firefox (and Thunderbird) reads configuration files located in installation folder/defaults/pref/*.js. In this folder are a number of files. The exact files might vary from version to version of Firefox, but a typical installation has the following files:

  • firefox.js is a file that holds preferences in the same format as prefs.js and user.js.

  • firefox-l10n.js is used to hold location information (such as country and language information).

  • inspector.js holds preferences specific to Firefox’s DOM inspector. This tool may be launched from Tools, DOM Inspector.

Firefox.js serves the same basic functionality as prefs.js in the user profile—it defines default properties and settings. Changes in this file are global and can affect all Firefox users on the computer.

That said, there is no reason not to alter firefox.js, assuming that you want all users to have a given preference by default. (They can override your settings in firefox.js in their prefs.js or user.js files anyway.)

A global configuration example might be an organization that is distributing Firefox to many employees or members. A company logo might be included, network settings might be preconfigured, and Firefox’s chrome (the look and feel) can be altered for all copies. Of course, after a user installs Firefox, he would be able to customize it himself, too.

Global Properties

Preferences are a single setting that tells Firefox how to work. Properties are more complex objects, such as how a font looks (color, size, style, and so on).

Following is a list of the global property locations found in a typical Firefox installation:

  • C:Program FilesMozilla Firefox

  • C:Program FilesMozilla Firefox es

  • C:Program FilesMozilla Firefox esentityTables

  • C:Program FilesMozilla Firefox esfonts

The following file types might be found in these folders, although some folders differ in the types of files they contain. There might be other file types in addition to these listed:

  • CSS—Cascading style sheets define how pages and other objects look.

  • GIF—Graphic images, such as buttons, are stored in GIF files. (Any supported graphics format for these types of objects is acceptable, so it is possible that there will be JPG, .BMP, or other graphic formats as well.)

  • Properties—Various Firefox properties are described in properties files. These are not formatted the same way that a JavaScript or cascading style sheet file is formatted. Rather they use # to designate comment lines, and data consists of parameter=value lines. A few lines from a .properties file are shown in Listing 6.1.

Listing 6.1 contains a short segment of the file charsetalias.properties. The first three lines are comments and the final three lines are parameter=value data lines. For example, these three lines define how Firefox will handle the ISO-859 character set. There are four ways that the character set might be designated (latin1, latin2, iso_8859-1, and iso8859-1) and they are all mapped to ISO-8859-1.

The entire file consists of about 500 lines of comment and data lines.

Example 6.1. A Short Segment of a Firefox Properties File

##
## Aliases for ISO-8859-1
##
latin1=ISO-8859-1
iso_8859-1=ISO-8859-1
iso8859-1=ISO-8859-1

If you are working in a language other than the default and find that some characters are not properly mapped to the correct character set, one place to look would be in charsetaliax.properties.

Defaults.ini and Components.ini

In addition to the previously mentioned configuration files, Firefox 1.x and Thunderbird 1.x both read additional configuration files found in user profiledefaults.ini and installation folderdefaults.ini.

The format of each of these files is identical. Defaults.ini describes additional files that might be loaded to set default values. This allows adding additional default initial settings. Components.ini allows for additional component files to be read.

The format of these two files is

[extra files]
count=n
filename to load

[extra files] describes the purpose of this .ini file. Count=n, where n is an integer equal to or greater than zero, indicates the count of files to be loaded from the list that follows. Filename to load is the name of a configuration file that is to be loaded.

An example of defaults.ini (taken from one of my Firefox installations):

[Extra Files]
Count=1
File0=extensions/{6b6601f1-361e-4b9f-bb6d-f8305000e4f6}/defaults/preferences

Note

Both defaults.ini and components.ini might also be found in the user’s profile. If they are found in the user’s profile, they are also read and processed by Firefox. Anything found in the user’s profile overrides the global installation folder values.

This says that there is a set of default preferences located in extensions{6b6601f1-361e-4b9f-bb6d-f8305000e4f6}. That strange set of characters in the braces is the GUID for the GoogleBar extension. Inside the extension’s folder is a subfolder called defaults, which has a subfolder named preferences. Defaults are the values that would be used for a new profile’s default preferences for the GoogleBar extension. These preferences are stored in a file named googlebar.js.

Changing the preferences for the GoogleBar extension requires that you extract the googlebar.js file from the extension’s XPI file, modify it, and then put the modified file back into GoogleBar’s XPI file. Then you could distribute this modified extension’s XPI file to other users in your organization and they would then have the default preferences you have set.

Creating and Editing user.js

By default, Firefox does not have a user.js file. This file must be created by the user. There is neither a way to create the user.js file from Firefox, nor does Firefox update a user.js file. The user.js file is really the final say for preferences; it is processed last and its contents override prefs.js. (Firefox does update prefs.js based on the contents of user.js.) Because Firefox automatically updates and modifies prefs.js, Mozilla recommends (and I concur) that you not modify prefs.js. Instead it suggests adding those preferences you wish to set or modify in user.js.

There are two ways to create your user.js file. The first way, and perhaps the easiest, is to simply use a basic text-based editor (such as Window’s notepad program).

The second way is to copy the file prefs.js to your user.js. (Just don’t rename it, you must copy!) Change whatever items in your new user.js file as necessary, and delete any extraneous lines to clean up the file. When modifying user.js, use care to observe the syntax of the file, and add any comments necessary so that should you later go back to the file, you will be able to remember why you made a certain change.

The user.js file is covered in Chapter 4, “Managing Profiles.”

An excellent reference for preferences that are set in prefs.js and user.js may be found at http://preferential.mozdev.org/preferences.html. This web page documents virtually every settable preference for Firefox. (However, additional extensions and plug-ins might have settings that will not be documented at this location.)

Cascading Style Sheets: A Primer

Web developers use Cascading Style Sheets to define style for their web pages. Firefox allows the user to create Cascading Style Sheets to override a web developer’s settings and change the way Firefox displays web content.

What are Cascading Style Sheets (CSS)? Breaking this term into two parts, they are style sheets, which are readable and editable descriptions of how something looks. In Firefox, style sheets might change or set the look of the Firefox user interface, and set default and overriding appearance specifications for a displayed document.

Cascading is the concept that there might be many levels of style sheets and it governs how they are applied. You might have a style sheet that defines how the overall document appears. Then sections of the document might have additional style sheets that override the document’s style sheet for that particular section. Hence, the term cascading style sheets.

Note

It is a really good idea to read and understand the CSS Level 1 and CSS Level 2 specifications that are found at W3.org. The web pages www.w3.org/TR/REC-CSS1-961217.html#css1-properties (for Level 1) and www.w3.org/TR/REC-CSS2/ (for Level 2) contain virtually all the information needed to write Cascading Style Sheet code.

A cascading style sheet consists of sets of rules describing a particular property and its attributes. The following HTML line consists of the HTML tag <blink>, some text, and the closing tag. Add this line to a HTML page and the text blinks.

<blink>like this</blink>

In this example, the text like this blinks in a browser window. (The fact is, it won’t blink in Internet Explorer because Internet Explorer doesn’t support the HTML tag <blink>!)

However, should this tag appear on a web document, Firefox blinks the text. And some of us find that blinking to be really, really annoying! With a cascading style sheet, you can configure how the <blink> HTML tag is handled (whether it will blink).

For example, your cascading style sheet might contain

blink { text-decoration: none !important; }

This rule modifies how the <blink> tag is handled. This is called a cascading style sheet rule. A rule typically consists of two parts: the selector and the declaration. Another way of expressing the syntax of a cascading style sheet rule is

rule {selector : value ! important ; }
/* In the syntax description above, items in italics
   are optional and need not be included if not desired.
   As well, the space before the colon, and the space after the
   exclamation are usually omitted. */

In your style sheet, the rule’s selector is the word blink, the first word in the rule.

Following the rule is an opening brace {. Following the brace is the declaration. Your declaration consists of a keyword, text-decoration:; a setting, none; and an !important. Technically, the exclamation point is not part of the keyword important, but many people omit the space, making it appear as a single word or identifier. A space following the exclamation point is optional. The rule ends with a closing brace, }, which is not optional.

You can see that the <blink> tag’s action is being changed. By setting text-decoration: to none, you are saying that you don’t want any blinking. The next part, !important, tells Firefox that this rule takes precedence over any other rule for this selector and declaration. That way, should the writer of the HTML page tried to reset <blink> back on to a blinking state, you can stop her. If you leave off !important, the web page’s cascading style sheets could turn blinking back on.

Cascading style sheets may have comments, provided they are enclosed in ‘/*’ and ‘*/’ pairs:

/* We force the <blink> tag to not do anything! */

A comment before a rule telling the rule’s intention is a very good idea. I also recommend that if the declaration’s setting values are not obvious, they be documented as well.

Rules may include as many declarations as desired. There is no limit. Each declaration must consist of an attribute that may be set for a given object. An example of a more complex rule is

blink{
   text-decoration: none ! important;
   color: red ! important;
   background: blue ! important;
}

In this example, you turn off blinking, but set the background color to blue and the text color to red (the worst possible combination of colors a page can have!)

Editing userChrome.css

The userChrome.css file is used to control what Firefox looks like. Hundreds of possible settings can be placed in this file, all of which contribute to the look and feel of Firefox.

Mozilla provides you with an example file (userChrome-example.css) you can use as the basis for your userChrome.css. To do this, copy the example file provided to a new file named userChrome.css. This file may then be edited in your favorite text-based editor (either Notepad or WordPad work fine for this task).

Most Firefox users don’t realize just how customizable the user interface is. With userChrome.css it is possible to define the appearance of the following items. The list is not an exhaustive list of everything that can be set. Rather, it is intended to be representative of what can be customized in Firefox.

As an example, menus in Firefox (and in any program, really) consist of some of the following objects:

  • menubar—. The menubar is the top level of menu items.

  • menupopup—. The menupopup consists of the drop-down menus that display when a menubar item is selected (clicked).

  • popup—. The popup menus are those menus that are displayed when the user right-clicks.

You are able to set many aspects of what you see in each of the menu categories. For example:

  • border—. The number of pixels in the border of the object.

  • padding—. The number of pixels of padding between items in the object.

  • background-color—. The color of the background, expressed as a six character (three byte) red/green/blue hexadecimal number or as a predefined color attribute.

  • margin—. The margin for the object, in pixels. Often set to zero.

  • background-image—. Instead of a background color, an image (of any type that Firefox supports) may be specified.

There are other attributes that may be set; these are examples of common attributes that many users might use.

For example, you might want to change the appearance of Firefox’s menus. The code to do this in the userChrome.css is shown in Listing 6.2.

Example 6.2. A Sample userChrome.css File

/* Actual menu bar */
menubar > menu {
   /* Set border to 1 pixel */
   border: 1px solid transparent !important;
   /* set padding top bottom left right */
   padding: 2px 5px 2px 7px !important;
   /* set margins */
   margin: 0 !important;
   /* don't use a solid color, use image as background */
   background-image: url("FeatherTexture.bmp") !important;
}

/* Selected menu item main menu */
menubar > menu[_moz-menuactive="true"] {
   /* default background color to the predefined color named
'Highlight' */
   background-color : Highlight !important;
   /* default color to the predefined color named 'HighlightText' */
   color: HighlightText !important;
   /* Don't use a solid color, use image as background */
   background-image: url("Santa Fe Stucco.bmp") !important;
}

/* Selected menu item popup menu */
menupopup [_moz-menuactive="true"] {
   /* default background color to the predefined color named
'Highlight' */
   background-color : Highlight !important;
   /* default color to the predefined color named 'HighlightText' */
   color: HighlightText !important;
   /* Don't use a solid color, use image as background */
   background-image: url("Zapotec.bmp") !important;
}

Now, some more information is in order:

  • Images without a path are in the same folder as userChrome.css. If another folder is used for images, a path must be included. You might find it easier to move all images to the same folder as userChrome.css.

  • Predefined colors are listed in the cascading style sheet documentation. Try a color; if it does not work well, create what you want as an RGB value.

  • Dimensions are usually expressed in pixels (px).

  • The keyword !important is required to override any other definitions of a given attribute. If you code an object attribute and that definition doesn’t seem to do anything, you have probably forgotten the !important keyword. This keyword simply sets whether this overrides other definitions or might be overridden itself.

  • Groups of attributes for a single object are enclosed in braces {}.

  • There is no error reporting for userChrome.css (or any other cascading style sheet). Make a mistake and the line (or lines) in error is ignored. Firefox probably won’t crash, but it will not perform as expected.

Note

The userChrome.css file can be simple or complex. For more extensive modifications, I strongly recommend that you back up your userChrome.css files and the entire user’s profile folder set.

Creating and Editing userContent.css

The userContent.css file allows you to modify the way Firefox displays web content. With userContent.css you can define defaults for web pages and content.

You might think that a web page doesn’t have any defaults at the browser level, but in fact with Firefox there are many defaults you can apply.

From the box, Firefox doesn’t have a userContent.css file. There is a userContent-example.css that you may copy to create your userContent.css file.

Note

In userContent.css, the flag !important is used to control how the settings specified are applied to the web page. If there is no !important flag, the web page might change the defaults established in userContent.css. However, if !important is included, your settings in userContent.css override the web page’s settings.

Some examples of userContent.css tweaks are taken from several listed websites. I recommend that rather than attempting to type this code, you go to the original URL and copy and paste.

The website http://db.rambleschmack.net/pc_tips/firefox_tweaks gives examples on how to make error pages look better. This example is fairly lengthy, but shows how each rule contains a number of selectors.

The following code is from http://cssing.blogspot.com/2004/08/my-own-firefox-usercontentcss-tweaks.html.

/* Generally, most users do not get excited with either
 * a marquee (text that scrolls in a box), or with
 * blinking text. With userContent.css you can turn both
 * off
*/

/* Turn off the scrolling Marquee effects */
marquee { display: none !important; }
/* Do not allow text to blink */
blink { text-decoration: none !important; }

A third example is code to block advertisements. This example may be found at www.mozilla.org/support/firefox/adblock.html. Cut and paste the code into your userContent.css file. (If you are using the AdBlock extension, this code is not necessary.)

Using Themes

Themes in Firefox allow the user to quickly change the overall way that Firefox looks. Rather than sit and design a look and feel, themes can be downloaded from the Internet. In addition, all users can create a theme to match their likes and dislikes and maybe even publish their theme for others to use.

Note

The file type Jar (stands for Java ARchive) is a file that holds both files and their relative folder locations. It is like a ZIP file, but without compression. The specifications for Jar files can be found at http://java.sun.com/developer/Books/javaprogramming/JAR/.

Using themes can be as simple as clicking on a link in a website. It is also possible to download and install one of the theme helper tools, or to manually install a theme.

Themes are stored in the installation folder’s chrome subfolder. A theme is held in a .jar file (the Jar format is used to hold files and folder information to make downloads easier).

Figure 6.2 shows the themes installed on my Firefox installation.

Jar files are used to hold themes and other collections of files. Use TUGZip to open them under Windows.

Figure 6.2. Jar files are used to hold themes and other collections of files. Use TUGZip to open them under Windows.

Themes are discussed in more depth in Chapter 7, “Themes and Plug-ins.”

Changing Browser Behavior and Appearance

You can change the way Firefox looks and works in many ways. Both the userChrome.css and the userContent.css files do just this. However, the interface for these cascading style sheet files is limited at best. Some tools and utilities have been created to improve the process of modifying the way Firefox looks and feels.

Flexbeta FireTweaker

An interesting program that enhances Firefox is Emilsoft’s Flexbeta FireTweaker. This program is freeware for personal and noncommercial use.

FireTweaker enables the user to change a number of aspects of Firefox using an interface that is both friendly and well organized. FireTweaker has five categories of tweaks: Appearance, Behavior, Performance, Web Page Appearance, and Rollback.

Note

FireTweaker is, like many of the other Firefox additional tools and extensions, updated often. The features described below might be extended or modified by the time you read this. In fact, I’d bet on it!

To download FireTweaker, go to http://www.softpedia.com/get/Tweak/Browser-Tweak/Flexbeta-FireTweaker-XP.shtml.

Appearance

There are seven tweaks to change the appearance of your browser, as Figure 6.3 shows. These tweaks are

  • Use Windows XP Styled Menus—This tweak makes Firefox’s menu appearance match the default Windows XP style (Luna).

  • Use Windows Classic Styled Menus—Some users have a preference for the user interface from Windows 9x, Me, and 2000. This tweak makes Firefox’s menus match the older user interface style.

  • Easy Tabs!—Using this tweak, you can make Firefox’s tabs more easily identifiable. It also allows color modifications. (Users who have extensions, such as Tabbrowser Extensions, installed might find that this tweak interferes with the extension.)

  • Disable Bold Text on Active Tabs!—By default, the active tab’s title text is bold. This allows turning off the bold attribute for the title text.

  • Remove the Close Button from the Tab Bar—This allows removing the close button and top menu items that you don’t use or want.

  • Remove Extra Padding from the Navigation Toolbar—This allows squeezing together the toolbar buttons to allow more space on the toolbar.

  • Display Sidebar on the Right—The sidebar (either Bookmarks or History) is moved to the right side of Firefox, rather than being on the left.

FireTweaker Appearance options control how Firefox looks. Be careful to not set options that conflict with installed options.

Figure 6.3. FireTweaker Appearance options control how Firefox looks. Be careful to not set options that conflict with installed options.

Behavior

Figure 6.4 shows the Behavior section. This section contains tweaks that affect how Firefox feels. There are eight tweaks in Behavior:

  • Open External Links in New Windows or Tabs—Tells Firefox not to reuse the existing window when another program requests that Firefox open a document or page.

  • Disable target='_blank'Firefox’s built-in pop-up blocker does not stop target='_blank' or target='_new' pages from opening in a new window. What this option does is make Firefox open all links in the same browser window/tab, ignoring above targets (if so specified in a web page).

  • Always Display the Stylesheet Switcher—This tweak displays a Stylesheet Switcher button in the toolbar.

  • Use Error Pages Instead of Dialog Boxes—When an error (page not found or the like) is detected, Firefox uses a dialog box to display the error. Internet Explorer displays this information in the browser window, and this tweak forces Firefox to do the same.

  • Tweak Find As You Type—The Find As You Type feature is a nice addition to Firefox. This tweak allows setting some hidden preferences for this feature, such as sounds, time out, and sounds.

  • Change the Search Mode in the Address Field—A search term in the Location Bar causes a Google search using the I’m Feeling Lucky feature. This tweak allows the search results page to display instead.

  • Disable Other JavaScript Window Features—Access to some additional JavaScript options is added to Firefox with this tweak.

  • Disable Bookmark Icons—As the name says, it sets Firefox to not display Bookmark icons.

FireTweaker Behavior options control how Firefox works.

Figure 6.4. FireTweaker Behavior options control how Firefox works.

Performance

In Performance (see Figure 6.5) there are tweaks that improve the performance of Firefox:

  • Speed up page rendering—Firefox does not start to render a page until either all of the page’s data has arrived or when 250 milliseconds (1/4 second) have passed, whichever happens first. If this delay (1/4 second doesn’t sound like much, does it?) is reduced or set to zero, Firefox more quickly attempts to render the page. The downside of this tweak is that it can slow Firefox’s performance on some pages.

  • Enabling pipelining—By default, Firefox queues a single request to the server at a time. Pipelining allows Firefox to queue multiple requests to speed up requests. Some web servers choke on this option, causing a page error.

  • Memory cache usage—The amount of memory that Firefox uses for the cache. Usually Firefox allocates the cache memory dynamically based on the free memory available. It is possible to specify zero to have no cache, a positive number to specify memory in kilobytes, or -1 to allocate dynamically.

  • Specify where to store the cache—No, not memory cache, but page cache, which is stored on the hard drive. It is possible to set the cache location to a different (nondefault) location. Why? Some systems are set up where the default cache location is on a network device, which might limit Firefox’s performance. This functionality is built into Firefox version 1.1.

FireTweaker Performance options control settings that change Firefox performance.

Figure 6.5. FireTweaker Performance options control settings that change Firefox performance.

Web Page Appearance

The web page look and feel is settable in userContent.css. FireTweaker allows a few easy changes without going through building a userContent.css file (see Figure 6.6). These tweaks include

  • Ad Blocking—This is a tweak that allows Firefox to block many of the advertisements that are contained on web pages.

  • Disable Blinking Elements—Although Internet Explorer doesn’t support the <blink> HTML tag, Firefox does! If you are like most of us, blinking is disliked at best. This tweak turns off the <blink> tag.

  • Disable <marquee> Tags—While blinking is just disliked, the <marquee> tag is a downright scrolling annoyance.

  • Force Frames To Be Resizable—Allows you to make all frame borders resizable. That way when a web page has a frame too small for the contents, you can resize it.

  • Change the Cursor for Links that Open in New Window—Some links are hardwired to open in a new window. Some people find this annoying, and this tweak allows the user to spot these links prior to clicking. An earlier tweak in Behavior showed how to modify this behavior.

  • Change the Cursor for JavaScript Links—Links can also perform a JavaScript command. Again, sometimes you don’t want to click on these, so this tweak shows these links with a different mouse pointer.

FireTweaker Web Page Appearance options control a web page’s look and feel. These tweaks work using userContent.css.

Figure 6.6. FireTweaker Web Page Appearance options control a web page’s look and feel. These tweaks work using userContent.css.

Note

FireTweaker uses Microsoft .NET Framework 1.1. If you do not have Microsoft .NET Framework 1.1 installed, you must download and install it first before FireTweaker will install and run. The install file for Microsoft .NET Framework 1.1 is 24MB in size; a fast Internet connection or a large pot of coffee is needed for this download.

FireTweaker should be checked before installing to be sure that it will work with your version of Firefox. If it is listed as not compatible, you might need to obtain either an upgrade to Firefox or to FireTweaker.

Rollback

The Rollback feature of FireTweaker allows you to automatically remove all tweaks that have been installed by FireTweaker (see Figure 6.7). It also removes all tweaks you have applied.

Rollback allows you to remove tweaks that have been applied manually and with FireTweaker.

Figure 6.7. Rollback allows you to remove tweaks that have been applied manually and with FireTweaker.

In Rollback, there is a single option to remove tweaks.

ChromEdit: User Profile File Editor

Somewhat less sophisticated than FireTweaker is a small extension for Firefox called ChromEdit. This extension loads Firefox’s current user configuration files (userChrome.css, userContent.css, user.js, and prefs.js) and allows editing of these files. One main benefit of this little utility is that it ensures the user is editing the correct profile.

ChromEdit’s main window is shown in Figure 6.8.

ChromEdit is a useful editor to modify the Firefox configuration files. It has the ability to edit and save, and not much else.

Figure 6.8. ChromEdit is a useful editor to modify the Firefox configuration files. It has the ability to edit and save, and not much else.

ChromEdit is a very useful utility, and there are more improvements you can make to Firefox, as seen next.

Other Browser Performance Improvements

Other improvements enhance Firefox’s performance. These improvements include more than just improving rendering or communication. Rather they might make a combination of changes to Firefox’s configuration

Firefox waits for about a quarter of a second (250 milliseconds) before it attempts to render a document if the document has not been fully received. (A document is always rendered as soon as it is fully received, even if this time is less than a quarter second.)

It is possible to tell Firefox to start painting the page as soon as enough information has been received to allow painting to start. By default this is on, with that delay of a quarter second. Setting the time value to a lower value (or zero) shortens the wait before painting:

// Last value in milliseconds (default is 250)
user_pref("nglayout.initialpaint.delay", 0);

When pages are painted, there are cases where the page must be reflowed, or adjusted, to allow content received after painting has begun to fit properly on the document. This reflowing is controlled by a preference:

// ontimer is boolean, either true (1) or false (0)
user pref("content.notify.ontimer", 1);

The default value for this preference is true (1), and this value will probably provide the best performance. However, for some documents adjusting this to false (0) might help speed the painting process.

The time steps for reflows are defined by the content.notify.interval preference. There will only be a limited number of reflows before Firefox simply waits for the content to be received without doing a reflow.

// Interval is in microseconds (millionth's of a second)
user pref("content.notify.interval", 120000);

Recommended values are between 100,000 and 500,000 (one-tenth to one-half second). Some examples set this to a very low value; however, values below 100,000 typically hinder performance, not enhance it!

Firefox tries to reflow the document a certain number of times, and then simply stops and waits until the document’s content has been received. If this preference is set to -1, a reflow never happens. Typical values are between 5 and 20, and vary with both the speed of your Internet connection and your computer’s speed.

// Number of reflows before waiting for complete document:
user pref("content.notify.backoffcount", 10);

The backoffcount preference can be set by trial and error. If you change computers or connections, you will need to retune this value, however.

Pipelining More Speed

One of the topics I studied when I got my graduate degree was queuing theory. It was a difficult task—optimize the serving of customers in a number of scenarios. It is actually more complex than that because these theories can be applied to manufacturing processes as well.

It gets even better—now I can apply my training in queues in computer software. You can do this, too!

Traditionally browsers have followed a simple process in retrieving a web page from the server. The server asks for a certain element. After it gets that element, the browser asks for the next element. The process is simple, and in theory should work just fine.

Let’s look at a set of log entries for a web page. In Table 6.1 is a typical session to get a page. This session spans a total time of about one second. During this time, a total of six requests were made by the client. This is not an example of a dial-up Internet user with a slow connection; some of those requested objects were large. In fact, the web server received requests to send to this user more than 600KB of information in the span of one second. The time to send this information would be between five and ten seconds.

Table 6.1. Web Page Requests

Time

Command

Size (KB)

23:09:56

GET /photo.htm

12

23:09:56

GET /photogallery/photo26003/MISC4.jpg

142

23:09:57

GET /photogallery/photo26003/mycat.jpg

18

23:09:57

GET /photogallery/photo26003/HMR4.gif

92

23:09:57

GET /photogallery/photo26003/MISC5.jpg

159

23:09:57

GET /photogallery/photo26003/MISC6.jpg

163

But notice what the client did—it issued six GET commands prior to receiving the information from the previous GET. This is an example of pipelining by a browser. Multiple requests have been queued and are being responded to by the server.

By default, Firefox has pipelining turned off. Pipelining is configured with the following three preferences, accessible through about:config (see Chapter 9, “Changing Preferences and Settings,” for more information about about:config):

  • network.http.pipelining—. This preference is set to false by default. To enable pipelining, set it to true.

  • network.http.pipelining.maxrequests—. By default, maxrequests is set to four. A good number to use is between four and eight. The (undocumented) maximum is eight requests; setting a value greater than eight has no additional effect. This value has no effect if pipelining is not enabled.

  • network.http.proxy.pipelining—This preference is set to false by default. To enable proxy pipelining, set it to true.

A good document to learn more about pipelining is www.w3.org/Protocols/HTTP/Performance/Pipeline.html. This page gives you background information on the implementation of HTTP pipelining.

A good reference on pipelining in Firefox can be found at the Firefox pipelining FAQ at www.mozilla.org/projects/netlib/http/pipelining-faq.html. Again, if you are interested in pipelining, visit the page.

The Firefox pipelining support is contained in the source folder mozilla etwerkprotocolhttpsrc. Do a search for pipelining in these folders to determine what files are involved in pipelining.

To get the most out of pipelining, a number of other preferences should be tweaked. These tweaks are very effective for users who have a high-speed connection (such as DLS or cable modems):

network.http.max-connections 32
network.http.max-connections-per-server 8
network.http.max-persistent-connections-per-proxy 8
network.http.max-persistent-connections-per-server 4
network.http.pipelining true
network.http.pipelining.maxrequests 8

The first four preferences increase the number of connections for a server. The final two are preferences that tune pipelining. However, on a few websites, this preference setting might provide only a nominal increase in performance, but for most, the differences are very noticeable.

Note

Most of the following preferences are used in nsHTMLContentSink.cpp. This file has some comments that describe the process of drawing content. nsHTMLContentSink.cpp is part of the Firefox source code. See Chapter 18, “Browsing the Code,” for information on how to retrieve the Firefox source.

Consider this: Three objects need to be drawn. None of these objects has been fully received, but if the browser waits until each one is fully received, the rendering is much slower. Rather, while waiting, the browser draws what it has, even if it’s not complete.

Miscellaneous Performance Preferences

Some preferences that can be set to improve Firefox performance include the ones in the following list. Some deal with rendering (those whose name begins with content), and some are used in other locations. In most items where a time is listed, the time is in microseconds. A microsecond is one millionth of a second. Many times computers deal in milliseconds (thousandths of a second). In cases where milliseconds are needed, Firefox divides microseconds by 1,000 to convert to milliseconds.

The following preferences may be added to user.js or be set using about:config (see Chapter 9 for more information about about:config):

  • browser.cache.disk_cache_ssl—. This preference is set to -1 if memory is determined dynamically, to 0 if there is no cache for SSL, and a positive value to specify memory in kilobytes. This preference is frequently set to indicate that there is to be no caching, although you can experiment with other values.

  • browser.cache.memory.capacity—. This preference is set to -1 to dynamically determine the capacity, to 0 if none, or a positive value to indicate the value in kilobytes.

  • browser.xul.error_pages.enabled—. This preference tells Firefox to use XUL error pages instead of pop-up windows when a page load error is detected. Pop-up windows require that the user explicitly close them, while XUL error pages do not. Also, when this preference is set, the Show Failed URL extension makes a valuable addition to Firefox.

  • content.interrupt.parsing—. If set to true, the parser might be interrupted. This can improve performance if turned on. The parser is the part of the program that interprets the HTML code.

  • content.max.tokenizing.time—. This preference specifies how long you stay away from the event loop when processing a token. A lower value makes the application more responsive but might increase page load time. Usually this value should be three times the content.notify.interval preference, which is what Firefox does if it is not specified.

  • content.notify.interval—. Dynamically effects how long Firefox initially waits before displaying a page when Firefox is being used on a slow connection (dialup, for example). Values below 100,000 might adversely affect page loading performance. Values above this will improve page load performance. The default value is 750,000 (3/4 second); a typical value might be 200,000 (1/5 second).

  • content.notify.ontimer—. A true or false setting to determine whether Firefox does notifications based on time. This preference is usually set to true.

  • content.notify.backoffcount—. This preference specifies the number of times the counter might be decremented before it reaches 0. If this preference is set to -1, the counter is never decremented.

  • content.switch.threshold—. Setting this preference to 750,000 (3/4 of a second) sets the switching interval. See content.notify.interval for additional information.

  • network.http.max—. Specifies a limit to the number of connections that can be established for all hosts. This effects all connections to hosts or the proxy server, if there is one. By default, this preference is set to 24.

  • network.http.max-connections-per-server—. Limits the absolute number of http connections to a single server and specifies the number of connections that can be established for a given host. There is some controversy on this preference as higher numbers of connections can cause adverse server operation, as the server might think it is busier than it really is. This affects either the host or the proxy server, if there is one. By default, this preference is set to eight.

  • network.http.max-persistent-connections-per-proxy—. When using a proxy server and when network.http.keep-alive = true, this preference limits the number of persistent connections to the proxy server. The default value for this preference is four.

  • network.http.max-persistent-connections-per-server—. When no proxy server is used and when network.http.keep-alive = true, this preference limits the number of persistent connections. The default value for this preference is two.

  • network.http.keep-alive—. When false, neither network.http.max-persistent-connections-per-proxy nor network.http.max-persistent-connections-per-serve are used.

  • nglayout.initialpaint.delay—. This preference sets the delay for the initial paint. The default value is 250 milliseconds (1/4 second; unlike many other time related specifications, this is milliseconds, not microseconds!).

These are some of the commonly known preferences that affect performance. There might be many others. To find them, however, requires a careful search of the Firefox source code, an in-depth understanding on how Firefox works, and programming experience.

An example of using one of these preferences would be to add the line:

user_pref("nglayout.initialpaint.delay", 500);

to your user.js file. This doubles the delay before the document is rendered.

Reporting Broken Websites

Broken websites exist. However, some websites are broken in Firefox but continue to work well when viewed with other browsers. This is usually the result of a rendering or other issue where Firefox received data from the site that either was not properly designed or uses a functionality that is not supported. Of course, this could also result from programming bugs.

To report a broken website, select Help, Report Broken Web Site from Firefox’s menu. The first time you use this feature it asks you to accept Mozilla’s privacy policy.

After you have accepted the privacy policy, the Report a Broken Web Site dialog box is displayed. The current website’s URL is placed in the Web Site URL field (which, if you are not at the broken site, you must change). If the website is password protected, you must mark the check box.

You can choose a problem type from a provided list:

  • Browser Not Supported

  • Can’t Log In

  • Plug-in Not Shown

  • Other Content Missing

  • Behavior Wrong

  • Appearance Wrong

  • Other Problem

Below this list is a text box where you should provide whatever details might help Mozilla in determining the problem’s cause. Provide as much information as you can; something that seems of little importance to you might be the key to solving the problem.

A final field is provided for your email address. This is optional. However, if you don’t provide an email address, your report is therefore anonymous and if Mozilla is unable to determine the problem, they cannot do anything more. Providing an email address allows Mozilla to contact you if they have any questions.

Power Firefox Tricks and Techniques Secrets for Power Users

Here are a few ideas from the experts:

  • Find your configurations files. There are configuration files for Firefox and for the user. User configuration files are in the user’s profile, while Firefox default configuration files are found in Firefox’s defaults folder.

  • Each operating system family stores configuration files in a different location. You saw how to find your user configuration files, and where the Firefox default configuration folder is.

  • Firefox global preferences and properties are used to hold preferences for all users, and to initialize a new profile’s preferences.

  • Defaults.ini and components.ini are used to tell Firefox to load additional configuration files. Use this option to add your own global configuration changes.

  • Creating and editing user.js allows a user to set the highest priority preferences. Everything in user.js overrides settings from all other sources.

  • Cascading style sheets are used to control both the look and feel of web pages, as well as Firefox’s user interface. Cascading style sheets are standardized and substantial documentation on them is available on the Internet.

  • userChrome.css and userContent.css control the look and feel of Firefox, and the default look and feel for a web page.

  • You can use themes to change Firefox’s look and feel, much like other programs use skins. Themes modify userChrome.css, userContent.css, and other configuration files.

  • Flexbeta FireTweaker is a powerful tool to improve Firefox’s performance, look, and behavior. FireTweaker is a standalone program, not an extension.

  • ChromEdit is a user profile editor. Although you may edit userChrome.css, userContent.css, user.js, and prefs.js yourself, ChromEdit makes the task a bit easier.

  • Many additional browser performance improvements were covered in this chapter, including pipelining and rendering tweaking.

  • Along with everything else, the preferences that affect performance are described fully, with default and recommended values for most.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.66.182