Difference between revisions of "Firefox tweaks"

From ArchWiki
Jump to: navigation, search
m (Viewing PDF/PS inside Firefox: Improved some odd-sounding language.)
m (Prevent accidental closing)
(45 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{i18n|Firefox Tips and Tweaks}}
+
[[tr:Firefox İpuçları]]
[[Category:Web Browser (English)]]
+
[[Category:Web Browser]]
 
+
 
{{Article summary start}}
 
{{Article summary start}}
{{Article summary text|Firefox configuration and modifications}}
+
{{Article summary text|This page contains advanced Firefox configuration options and performance tweaks.}}
 
{{Article summary heading|Related}}
 
{{Article summary heading|Related}}
{{Article summary wiki|Browser Plugins}}: Acquiring and installing plugins such as [[Flash]]
+
{{Article summary wiki|Firefox}}
{{Article summary wiki|Firefox}}: Installing and troubleshooting the Firefox browser and plugins
+
{{Article summary wiki|Browser Plugins}}
{{Article summary wiki|Speed-up Firefox using tmpfs}}: Caching the profile in RAM
+
{{Article summary wiki|Firefox Ramdisk}}
 
{{Article summary end}}
 
{{Article summary end}}
  
Line 14: Line 13:
 
Improving Firefox's performance is divided into parameters that can be inputted while running Firefox or otherwise modifying its configuration as intended by the developers, and advanced procedures that involve foreign programs or scripts.
 
Improving Firefox's performance is divided into parameters that can be inputted while running Firefox or otherwise modifying its configuration as intended by the developers, and advanced procedures that involve foreign programs or scripts.
  
=== Tunables ===
+
{{Note|Always use the latest version of Firefox.}}
''Improvements stemming from native Firefox settings.''
+
 
 +
=== Advanced Firefox options ===
 +
This section contains advanced Firefox options for performance tweaking. For additional information see [http://forums.mozillazine.org/viewtopic.php?t=53650 this Mozillazine forum post].
  
 
==== Network settings ====
 
==== Network settings ====
''References: [http://forums.mozillazine.org/viewtopic.php?t=53650 Mozillazine]''
 
  
*All settings can be adjusted by browsing to ''about:config''.
+
Advanced network settings can be found on the {{ic|about:config}} page (try searching for ''network'').
*Values for connections (HTTP, proxy, etc.) should be tweaked based on connection.
+
  
These are the values for a 1.5Mb cable connection:
+
{| class="wikitable" border="1" style="width: 100%;" cellpadding="5" cellspacing="0"
<table border="1" cellpadding="2" cellspacing="0">
+
|+ Recommended values for a 1.5Mb connection
<tr>
+
! Key || Value || Description
<th>Key</th>
+
|-
<th>Value</th>
+
| network.http.pipelining || true || Enable [http://www-archive.mozilla.org/projects/netlib/http/pipelining-faq.html pipelining] for normal connections
<th>Description</th>
+
|-
</tr>
+
| network.http.proxy.pipelining || true || Enable pipelining for proxy connections
<tr>
+
|-
<td>network.http.pipelining</td>
+
| network.http.pipelining.maxrequests || 8 || Maximum HTTP requests per pipeline
<td>true</td>
+
|-
<td>enable pipelining for normal connections</td>
+
| network.http.max-connections || 64 || Maximum number of total HTTP connections
</tr>
+
|-
<tr>
+
| network.http.max-connections-per-server || 16 || Maximum number of any type of connections per server
<td>network.http.proxy.pipelining</td>
+
|-
<td>true</td>
+
| network.http.max-persistent-connections-per-proxy || 16 || Maximum number of keep-alive type connections per proxy
<td>enable pipelining for proxy connections</td>
+
|-
</tr>
+
| network.http.max-persistent-connections-per-server || 8 || Maximum number of keep-alive type connections per server
<tr>
+
|-
<td>network.http.pipelining.firstrequests</td>
+
| network.dns.disableIPv6 || true || Disable IPv6 support
<td>true</td>
+
|}
<td>enable pipelining of first requests</td>
+
</tr>
+
<tr>
+
<td>network.http.pipelining.maxrequests</td>
+
<td>8</td>
+
<td>maximum HTTP requests per pipeline</td>
+
</tr>
+
<tr>
+
<td>content.notify.backoffcount</td>
+
<td>5</td>
+
<td>number of initial reflows during rendering</td>
+
</tr>
+
<tr>
+
<td>content.interrupt.parsing</td>
+
<td>true</td>
+
<td>enable interruption of parsing to return to the application's event loop</td>
+
</tr>   
+
<tr>
+
<td>content.max.tokenizing.time</td>
+
<td>2250000</td>
+
<td>time after which parsing is interrupted</td>
+
</tr>       
+
<tr>
+
<td>content.notify.interval</td>
+
<td>750000</td>
+
<td>time steps for the initial reflows (content.notify.backoffcount)</td>
+
</tr>       
+
<tr>
+
<td>content.notify.ontimer</td>
+
<td>true</td>
+
<td>enable timer based reflows</td>
+
</tr>         
+
<tr>
+
<td>content.switch.threshold</td>
+
<td>750000</td>
+
<td>keep same as content.notify.interval</td>
+
</tr>
+
<tr>
+
<td>nglayout.initialpaint.delay</td>
+
<td>0</td>
+
<td>time before inital page reflow</td>
+
</tr>
+
<tr>
+
<td>network.http.max-connections</td>
+
<td>48</td>
+
<td>number of total HTTP connections</td>
+
</tr>
+
<tr>
+
<td>network.http.max-connections-per-server</td>
+
<td>24</td>
+
<td>maximum number of any type of connections per server</td>
+
</tr>     
+
<tr>
+
<td>network.http.max-persistent-connections-per-proxy</td>
+
<td>16</td>
+
<td>maximum number of keep-alive type connections per proxy</td>
+
</tr>
+
<tr>
+
<td>network.http.max-persistent-connections-per-server</td>
+
<td>8</td>
+
<td>maximum number of keep-alive type connections per server</td>
+
</tr>       
+
<tr>
+
<td>browser.cache.memory.capacity</td>
+
<td>65536</td>
+
<td>size of memory to use as cache - set as big as you can for normal operation</td>
+
</tr>
+
<tr>
+
<td>network.dns.disableIPv6</td>
+
<td>true</td>
+
<td>disables IPv6 support - may not work for all networks, some report speed increase</td>
+
</tr>
+
</table>
+
  
==== Turning off anti-phishing ====
+
{{Note|These settings need to be configured based on your connection.}}
{{note|Deleting files from your profile folder is potentially dangerous, so it's recommended that you make a backup of the folder first.}}
+
  
The anti-phishing features of Firefox may cause Firefox to become slow to start or exit, and might also affect the browsing speed since Firefox apparently contacts google for every http request. The problem is that Firefox maintains a sqlite database that might grow quite big, and reading and writing to this database begins to take some time when it grows bigger. If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature:
+
==== Turn off anti-phishing ====
 +
{{Note|Deleting files from your profile folder is potentially dangerous, so it is recommended that you back it up first.}}
  
* Turn off the following options under the security tab in preferences: "Block reported attack sites" and "Block reported web forgeries".
+
The anti-phishing features of Firefox may cause Firefox to become slow to start or exit. The problem is that Firefox maintains an [[Sqlite]] database that can grow quite big which makes reading and writing slower after repeated use. If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature:
  
* Delete all files beginning with urlclassifier in your profile folder (~/.mozilla/firefox/********.default where ******** is some combination of letters and numbers. Default might be something else if you have created a non-default profile). Some of these files might be recreated by Firefox, but they won't grow any larger than their initial size:
+
* Turn off the following options under the security tab in preferences: ''"Block reported attack sites"'' and ''"Block reported web forgeries"''.
$ rm -i ~/.mozilla/firefox/*.default/urlclassifier*
+
  
==== Improve rendering by disabling pango ====
+
* Delete all files beginning with {{ic|urlclassifier}} in your profile folder ({{ic|~/.mozilla/firefox/<profile_dir>/}}):
{{note|Exporting the setting may also fix font issues for the entire Mozilla suite.}}
+
$ rm -i ~/.mozilla/firefox/<profile_dir>/urlclassifier*
 +
 
 +
:Some of these files might be recreated by Firefox, but they won't grow any larger than their initial size.
 +
 
 +
==== Stop urlclassifier3.sqlite from being created again ====
 +
If you did remove all the {{ic|urlclassifier*}} files as mentioned above, you may find out that {{ic|urlclassifier3.sqlite}} keeps growing again after a certain time. Here is a simple solution to avoid it for now and ever.
 +
 
 +
$ cd ~/.mozilla/firefox/<profile_dir>
 +
$ echo "" > urlclassifier3.sqlite
 +
$ chmod 400 urlclassifier3.sqlite
 +
 
 +
This effectively makes the file empty and then read-only so Firefox cannot write to it anymore.
 +
 
 +
==== Improve font rendering by disabling pango ====
 +
 
 +
To disable [http://www.pango.org/ Pango] font handling in Firefox, add:
  
Add:
 
 
  export MOZ_DISABLE_PANGO=1
 
  export MOZ_DISABLE_PANGO=1
to {{filename|~/.profile}} and relogin for the change to take place.
 
  
=== Foreign modifications ===
+
to the {{ic|~/.profile}}, {{ic|/etc/profile}} (for all users), or shell configuration ({{ic|.bashrc}}... and re-login for the change to take place.
''Advanced Firefox alterations''
+
  
==== Reduce load time by compressing the Firefox binary with upx ====
+
{{note|Exporting the setting may also fix font issues for the entire Mozilla suite.}}
Install the {{package Official|upx}} package:
+
# pacman -S upx
+
  
Make a backup of the firefox binary:
+
=== Other modifications ===
# cp /usr/lib/firefox-5.0/firefox-bin /usr/lib/firefox-5.0/firefox-bin_backup
+
This section contains some other modifications that may increase Firefox's performance.
  
Invoke {{filename|upx}}, applying a compression level of 9:
+
==== Reduce load time by compressing the Firefox binary with UPX ====
  # upx -9 /usr/lib/firefox-5.0/firefox-bin
+
[http://upx.sourceforge.net/ UPX] is an executable packer that supports very fast decompression and induces no memory overhead. It can be [[pacman|installed]] with the {{Pkg|upx}} package, availalble in the [[official repositories]].
 +
 
 +
Before using {{ic|upx}} to compress the Firefox executable, make a backup of the binary:
 +
# cp /usr/lib/firefox/firefox /usr/lib/firefox/firefox.backup
 +
 
 +
Finally, invoke {{ic|upx}}, applying the best possible compression level:
 +
  # upx --best /usr/lib/firefox/firefox
  
 
==== Defragment the profile's SQLite databases ====
 
==== Defragment the profile's SQLite databases ====
{{Warning| This procedure may damage the databases in such a way that sessions are not saved properly.}}
+
{{Warning|This procedure may damage the databases in such a way that sessions are not saved properly.}}
  
===== Sample size differences comparison =====
+
In Firefox 3.0, bookmarks, history, passwords are kept in an SQLite databases. SQLite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve start-up and some other bookmarks and history related tasks is to defragment and trim unused space from these databases.
{| border="1"
+
 
| SQLite DB || Size Before || Size After || % change
+
{{AUR|profile-cleaner}} in the [[AUR]] does just this.
 +
 
 +
{| class="wikitable" border="1" style="width: 100%;" cellpadding="5" cellspacing="0"
 +
|+ Sample size differences comparison
 +
! SQLite database || Size Before || Size After || % change
 
|-  
 
|-  
 
|urlclassifier3.sqlite|| 37 M || 30 M || 19 %
 
|urlclassifier3.sqlite|| 37 M || 30 M || 19 %
Line 159: Line 104:
 
|-
 
|-
 
|}
 
|}
 
===== Profile defragmentation procedure =====
 
Firefox 3.0, bookmarks, history, passwords are kept in SQLite databases. SQLite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve startup and some other bookmarks and history related tasks is to defragment and trim unused space from these databases.
 
 
Run {{filename|sqlite3}} {{Ic|vacuum}} and {{Ic|reindex}} commands in the profile directory.
 
 
Example:
 
$ cd ~/.mozilla/firefox/*.default
 
$ for i in urlclassifier3 places; do \
 
    sqlite3 $i.sqlite vacuum;        \
 
    sqlite3 $i.sqlite reindex;      \
 
  done
 
 
To automate the process for all the databases in all the profiles directory, use the following:
 
$ find ~/.mozilla -name \*.sqlite    \
 
    -exec sqlite3 {} vacuum  \;    \
 
    -exec sqlite3 {} reindex \;
 
  
 
==== Cache the entire profile into RAM via tmpfs ====
 
==== Cache the entire profile into RAM via tmpfs ====
If the system has memory to spare, {{Ic|tmpfs}} can be used to [[Firefox Ramdisk|cache the entire profile directory]], which might result in increased Firefox responsiveness.
+
If the system has memory to spare, {{ic|tmpfs}} can be used to [[Firefox Ramdisk|cache the entire profile directory]], which might result in increased Firefox responsiveness.
  
 
== Appearance ==
 
== Appearance ==
 
=== Fonts ===
 
=== Fonts ===
''See also: [[Font Configuration]]''
+
{{Box||See the main article: [[Font Configuration]]|#E5E5FF|#FCFCFC}}
  
==== DPI ====
+
==== Configure the DPI value ====
Modifying the following value can help improve the way fonts looks in Firefox if the system's DPI is below 96.  Firefox, by default, uses 96 and only uses the system's DPI if it is a higher value. To force the system's DPI regardless of its value, type about:config into the address bar and search for '''layout.css.dpi'''. Change it to '''0'''.
+
Modifying the following value can help improve the way fonts looks in Firefox if the system's DPI is below 96.  Firefox, by default, uses 96 and only uses the system's DPI if it is a higher value. To force the system's DPI regardless of its value, type {{ic|about:config}} into the address bar and set {{ic|layout.css.dpi}} to '''0'''.
  
==== Default font settings from MS Windows ====
+
In [[Xfce]], the above method only affects the Firefox user interface's DPI settings, but web page contents still use a DPI value of 96, which may look ugly. A solution is to change {{ic|layout.css.devPixelsPerPx}} to system's DPI divided by 96. For example, if your system's DPI is 142, then the value to add is 142/96 = 1.48. Changing {{ic|layout.css.devPixelsPerPx}} to '''1.48''' makes web page contents use a DPI of 142, which looks much better.
 +
 
 +
==== Default font settings from Microsoft Windows ====
 
Below are the default font preferences when Firefox is installed in Microsoft Windows. Many web sites use the Microsoft fonts.
 
Below are the default font preferences when Firefox is installed in Microsoft Windows. Many web sites use the Microsoft fonts.
<pre>
+
{{bc|
 
Proportional: Serif Size (pixels): 16
 
Proportional: Serif Size (pixels): 16
 
Serif: Times New Roman
 
Serif: Times New Roman
 
Sans-serif: Arial
 
Sans-serif: Arial
 
Monospace: Courier New Size (pixels): 13
 
Monospace: Courier New Size (pixels): 13
</pre>
+
}}
 +
 
 +
=== General user interface CSS settings ===
 +
Firefox's user interface can be modified by editing the {{ic|userChrome.css}} and {{ic|userContent.css}} files in {{ic|~/.mozilla/firefox/<profile_dir>/chrome/}} (''profile_dir'' is of the form ''hash.name'', where the ''hash'' is an 8 character, seemingly random string and the profile ''name'' is usually ''default'').
  
=== General UI CSS settings ===
+
{{Note|The {{ic|chrome/}} folder and {{ic|userChrome.css}}/{{ic|userContent.css}} files may not necessarily exist, so you have to create them.}}
Firefox's UI can be modified by editing the files in {{filename|~/.mozilla/firefox/''RANDOMHASH''.''PROFILENAME''/chrome/}}; namely, {{filename|userChrome.css}} and {{filename|userContent.css}}.
+
  
All of the following modifications take place in {{filename|userChrome.css}}.
+
This section only deals with the {{ic|userChrome.css}} file which modifies Firefox's user interface, and not web pages.
  
==== Change UI font ====
+
==== Change the font ====
The setting effectively overrides the global GTK2+ font preferences, and does not affect the body; only the UI itself:
+
The setting effectively overrides the global GTK+ font preferences, and does not affect webpages, only the user interface itself:
<pre>
+
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|
 
* {
 
* {
 
     font-family: "FONT_NAME";
 
     font-family: "FONT_NAME";
 
}
 
}
</pre>
+
}}
  
 
==== Hide button icons ====
 
==== Hide button icons ====
 
Enables text-only buttons:
 
Enables text-only buttons:
<pre>
+
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|
 
.button-box .button-icon {
 
.button-box .button-icon {
 
     display: none;
 
     display: none;
 
}
 
}
</pre>
+
}}
  
 
==== Hiding various tab buttons ====
 
==== Hiding various tab buttons ====
 
These settings hide the arrows that appear to the horizontal edges of the tab bar, the button that toggles the "all tabs" drop-down list, and the plus sign button that creates a new tab.
 
These settings hide the arrows that appear to the horizontal edges of the tab bar, the button that toggles the "all tabs" drop-down list, and the plus sign button that creates a new tab.
<pre>
+
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<nowiki>
 
/* Tab bar */
 
/* Tab bar */
  
Line 235: Line 167:
 
     /* Hide new-tab button */
 
     /* Hide new-tab button */
 
     display: none;
 
     display: none;
}
+
}</nowiki>
</pre>
+
}}
  
 
==== Horizontal tabs ====
 
==== Horizontal tabs ====
 
To place the tab bar horizontally stacked along the sides of the browser window:
 
To place the tab bar horizontally stacked along the sides of the browser window:
<pre>
+
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|
 
/* Display the tabbar on the left */
 
/* Display the tabbar on the left */
 
#content > tabbox {
 
#content > tabbox {
Line 274: Line 206:
 
     -moz-box-orient: horizontal;
 
     -moz-box-orient: horizontal;
 
}
 
}
</pre>
+
}}
  
=== Web content CSS settings ===
+
==== Auto-hide Bookmarks Toolbar ====
In {{filename|userContent.css}} you can add custom css rules for web content. Examples:
+
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|
<pre>
+
#PersonalToolbar {
/* import other css file */
+
    visibility: collapse !important;
@import url("./imports/some_file.css");
+
}
  
/* block ads */
+
#navigator-toolbox:hover > #PersonalToolbar {
*[class*="advertisement"],
+
     visibility: visible !important;
*[class*="partners"],
+
*[class*="sidebaner"],
+
*[class*="banner"],
+
*[class*="adview"],
+
*[class*="promo"],
+
*[class*="ad_"],
+
*[name*="werbung"],
+
*[name*="banner"],
+
*[id*="banner"],
+
*[id*="ad_"],
+
iframe[src*="euroclick.com"],
+
iframe[src*="/partners/"],
+
iframe[src*="/adview"],
+
img[src*="euroclick.com"],
+
img[src*="/partners/"],
+
img[src*="/adview"],
+
embed[src*="Banner"],
+
embed[src*="banner"],
+
a:link[href*="euroclick.com"],
+
a:link[href*="/partners/"],
+
a:link[href*="/adview"]
+
{  
+
     display: none !important
+
 
}
 
}
 +
}}
  
/* domain specific rule */
+
==== Remove sidebar width restrictions ====
@-moz-document domain(example.com){
+
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|
        div#header{background-image:none !important}
+
/* remove maximum/minimum  width restriction of sidebar */
 +
#sidebar {
 +
    max-width: none !important;
 +
    min-width: 0px !important;
 
}
 
}
 +
}}
  
/* add '[pdf]' next to to pdf links */
+
=== Web content CSS settings ===
 +
This section deals with the {{ic|userContent.css}} files in which you can add custom CSS rules for web content. You can import other CSS files by adding to the file:
 +
 
 +
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|
 +
@import url("./imports/some_file.css");
 +
}}
 +
 
 +
==== Block certain parts of a domain ====
 +
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|
 +
@-moz-document domain(example.com) {
 +
    div#header {
 +
        background-image: none !important;
 +
    }
 +
}
 +
}}
 +
 
 +
==== Add [pdf] after links to PDF files ====
 +
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<nowiki>
 +
/* add '[pdf]' next to links to PDF files */
 
a[href$=".pdf"]:after {
 
a[href$=".pdf"]:after {
 
     font-size: smaller;
 
     font-size: smaller;
 
     content: " [pdf]";
 
     content: " [pdf]";
 +
}</nowiki>
 +
}}
 +
 +
==== Show URLs at the bottom of the screen when hovering a link ====
 +
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|
 +
a[href]:hover {
 +
    text-decoration: none !important;
 
}
 
}
</pre>
 
  
== Miscellaneous ==
+
a[href]:hover:after {
 +
    content: attr(href);
 +
    position: fixed; left: 0px; bottom: 0px;
 +
    padding: 0 2px !important;
 +
    max-width: 95%; overflow: hidden;
 +
    white-space: nowrap; text-overflow: ellipsis;
 +
    font:10pt sans-serif !important;
 +
    background-color: black  !important;
 +
    color: white !important;
 +
    opacity: 0.7;
 +
    z-index: 9999;
 +
}</nowiki>
 +
}}
  
=== Viewing PDF/PS inside Firefox===
+
==== Block ads ====
  
If you do not want for some reason to install Adobe Acrobat Reader for exploiting the feature to see PDF inside Firefox, you can use other software, like Evince (default viewer in GNOME).
+
See [http://www.floppymoose.com floppymoose.com] for an example of how to use {{ic|userContent.css}} as a basic ad-blocker.
  
For example if you want to open a pdf/ps or any other document type supported by evince inside firefox, without opening a new window, just follow these simple instructions:
+
== Miscellaneous ==
  
* install mozplugger (in this moment is in AUR) and evince (in extra)
+
Other tips and tweaks.
  
* delete ~/.mozilla/firefox/*.default/pluginreg.dat (as mentioned after mozplugger installation)
+
=== Mouse wheel scroll speed ===
  
* edit /etc/mozpluggerrc: find the line containing "pdf" word, after "GV()" edit evince line as below:
+
To modify the default values (i.e. speed-up) of the mouse wheel scroll speed, go to {{ic|about:config}} and search for {{ic|mousewheel.acceleration}}. This will show the available options, modifying the following:
  
  #repeat noisy fill exits: evince "$file"
+
* Set {{ic|mousewheel.acceleration.start}} to '''-1'''.
  repeat noisy swallow(evince) fill: evince "$file"
+
* Set {{ic|mousewheel.acceleration.factor}} to the desired number (10 to 20 are common values).
  
{{Note|you must place comments at the very beginning of the line to avoid errors}}
+
Alternatively you can install the [http://smoothwheel.mozdev.org/ SmoothWheel add-on].
  
* finally close (if not yet) and reopen firefox (now you can see a new plugin called mozplugger)
+
=== Change the order of search engines in the Firefox Search Bar ===
  
* try to open a pdf sample
+
To change the order search engines are displayed in:
 +
* Open the drop-down list of search engines and click ''Manage Search Engines...'' entry.
 +
* Highlight the engine you want to move and use ''Move Up'' or ''Move Down'' to move it. Alternatively, you can use drag-and-drop.
  
* old forum instruction deprecated "http://ubuntuforums.org/showthread.php?t=25685"
+
=== How to open a *.doc automatically with Abiword or LibreOffice Writer ===
  
{{ note | This method also works with other PDF viewers. Try replacing "evince"  with the name of another program. }}
+
Go to ''Preferences > Applications'' and search for ''Word Document'' (or ''Word 2007 Document'' for {{ic|*.docx}}). After finding it, click the drop-down list and select ''Use other...''. From there you have to specify the exact path to the Abiword or Writer executable (i.e.{{ic|/usr/bin/abiword}} or {{ic|/usr/bin/lowriter}}).
  
=== Wheel mouse scroll speed ===
+
=== Secure DNS with DNSSEC validator ===
  
To modify the default values (i.e. speed-up) of the wheel mouse scroll speed, type the following into Firefox's address bar:
+
You can enable [[DNSSEC]] support for safer browsing.
about:config
+
Now enter the following into the 'filter' dialog: '''mousewheel.withnokey'''
+
  
*Double-click the entry entitled, '''mousewheel.withnokey.sysnumlines''' and thereby setting its value to '''false'''
+
=== Adding magnet protocol association ===
*Double-click the entry entitled, '''mousewheel.withnokey.numlines''' and enter the desired number of lines per movement into the box (12, for example).
+
  
Restart firefox for this setting to take effect.
+
In {{ic|about:config}} set {{ic|network.protocol-handler.expose.magnet}} to '''false'''.
  
Alternatively you can install [http://smoothwheel.mozdev.org/ SmoothWheel add-on].
+
The next time you open a magnet link, you will be prompted with a {{ic|Launch Application}} dialogue. From there simply select your chosen torrent client. This technique can also be used with other protocols.
  
=== Change the order of searchplugins list ===
+
=== Prevent accidental closing ===
You can now (in Firefox 3) change the order in the GUI:
+
* Open the dropdown list of search engines and click Manage Search Engines
+
* Highlight the Engine you want to move and use Move Up or Move Down to move it.
+
  
=== How to open a *.doc automatically with abiword or open office ===
+
The [https://addons.mozilla.org/en-us/firefox/addon/disable-ctrl-q-shortcut/ Disable Ctrl-Q Shortcut] extension can be installed to prevent unwanted closing of the browser.
Click through the following menus:
+
*Edit
+
*Preferences
+
*File types
+
*Manage
+
*Select the {{filename|doc}} extension
+
*Select ''Open them with this application''
+
*Select {{filename|/usr/bin/abiword}} or {{filename|/usr/bin/soffice}}
+
  
There is also a plugin/addon called mime edit. This addon will let you edit the mime types for firefox.
+
An alternative is to add a rule in your window manager configuration file. For example in openbox add:
 +
  <keybind key="C-q">
 +
    <action name="Execute">
 +
      <execute>false</execute>
 +
    </action>
 +
  </keybind>
 +
in the <keyboard> section of your rc.xml file.
  
=== Secure DNS with DNSSEC validator ===
+
== See also ==
You can enable [[DNSSEC]] support for safer browsing.
+
  
== Resources ==
+
* [http://kb.mozillazine.org/Knowledge_Base MozillaZine Wiki]
* http://www.mozilla.org/support/firefox/tips
+
* [http://kb.mozillazine.org/About:config_entries about:config Entries Explained]
 +
* [http://linuxtidbits.wordpress.com/2009/08/01/better-fox-cat-and-weasel/ Top Fox: Completing the Feel of Firefox ]

Revision as of 02:10, 20 February 2013

Summary help replacing me
This page contains advanced Firefox configuration options and performance tweaks.
Related
Firefox
Browser Plugins
Firefox Ramdisk

Performance

Improving Firefox's performance is divided into parameters that can be inputted while running Firefox or otherwise modifying its configuration as intended by the developers, and advanced procedures that involve foreign programs or scripts.

Note: Always use the latest version of Firefox.

Advanced Firefox options

This section contains advanced Firefox options for performance tweaking. For additional information see this Mozillazine forum post.

Network settings

Advanced network settings can be found on the about:config page (try searching for network).

Recommended values for a 1.5Mb connection
Key Value Description
network.http.pipelining true Enable pipelining for normal connections
network.http.proxy.pipelining true Enable pipelining for proxy connections
network.http.pipelining.maxrequests 8 Maximum HTTP requests per pipeline
network.http.max-connections 64 Maximum number of total HTTP connections
network.http.max-connections-per-server 16 Maximum number of any type of connections per server
network.http.max-persistent-connections-per-proxy 16 Maximum number of keep-alive type connections per proxy
network.http.max-persistent-connections-per-server 8 Maximum number of keep-alive type connections per server
network.dns.disableIPv6 true Disable IPv6 support
Note: These settings need to be configured based on your connection.

Turn off anti-phishing

Note: Deleting files from your profile folder is potentially dangerous, so it is recommended that you back it up first.

The anti-phishing features of Firefox may cause Firefox to become slow to start or exit. The problem is that Firefox maintains an Sqlite database that can grow quite big which makes reading and writing slower after repeated use. If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature:

  • Turn off the following options under the security tab in preferences: "Block reported attack sites" and "Block reported web forgeries".
  • Delete all files beginning with urlclassifier in your profile folder (~/.mozilla/firefox/<profile_dir>/):
$ rm -i ~/.mozilla/firefox/<profile_dir>/urlclassifier*
Some of these files might be recreated by Firefox, but they won't grow any larger than their initial size.

Stop urlclassifier3.sqlite from being created again

If you did remove all the urlclassifier* files as mentioned above, you may find out that urlclassifier3.sqlite keeps growing again after a certain time. Here is a simple solution to avoid it for now and ever.

$ cd ~/.mozilla/firefox/<profile_dir>
$ echo "" > urlclassifier3.sqlite
$ chmod 400 urlclassifier3.sqlite

This effectively makes the file empty and then read-only so Firefox cannot write to it anymore.

Improve font rendering by disabling pango

To disable Pango font handling in Firefox, add:

export MOZ_DISABLE_PANGO=1

to the ~/.profile, /etc/profile (for all users), or shell configuration (.bashrc... and re-login for the change to take place.

Note: Exporting the setting may also fix font issues for the entire Mozilla suite.

Other modifications

This section contains some other modifications that may increase Firefox's performance.

Reduce load time by compressing the Firefox binary with UPX

UPX is an executable packer that supports very fast decompression and induces no memory overhead. It can be installed with the upx package, availalble in the official repositories.

Before using upx to compress the Firefox executable, make a backup of the binary:

# cp /usr/lib/firefox/firefox /usr/lib/firefox/firefox.backup

Finally, invoke upx, applying the best possible compression level:

# upx --best /usr/lib/firefox/firefox

Defragment the profile's SQLite databases

Warning: This procedure may damage the databases in such a way that sessions are not saved properly.

In Firefox 3.0, bookmarks, history, passwords are kept in an SQLite databases. SQLite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve start-up and some other bookmarks and history related tasks is to defragment and trim unused space from these databases.

profile-cleanerAUR in the AUR does just this.

Sample size differences comparison
SQLite database Size Before Size After  % change
urlclassifier3.sqlite 37 M 30 M 19 %
places.sqlite 16 M 2.4 M 85 %

Cache the entire profile into RAM via tmpfs

If the system has memory to spare, tmpfs can be used to cache the entire profile directory, which might result in increased Firefox responsiveness.

Appearance

Fonts

Template:Box

Configure the DPI value

Modifying the following value can help improve the way fonts looks in Firefox if the system's DPI is below 96. Firefox, by default, uses 96 and only uses the system's DPI if it is a higher value. To force the system's DPI regardless of its value, type about:config into the address bar and set layout.css.dpi to 0.

In Xfce, the above method only affects the Firefox user interface's DPI settings, but web page contents still use a DPI value of 96, which may look ugly. A solution is to change layout.css.devPixelsPerPx to system's DPI divided by 96. For example, if your system's DPI is 142, then the value to add is 142/96 = 1.48. Changing layout.css.devPixelsPerPx to 1.48 makes web page contents use a DPI of 142, which looks much better.

Default font settings from Microsoft Windows

Below are the default font preferences when Firefox is installed in Microsoft Windows. Many web sites use the Microsoft fonts.

Proportional: Serif Size (pixels): 16
Serif: Times New Roman
Sans-serif: Arial
Monospace: Courier New Size (pixels): 13

General user interface CSS settings

Firefox's user interface can be modified by editing the userChrome.css and userContent.css files in ~/.mozilla/firefox/<profile_dir>/chrome/ (profile_dir is of the form hash.name, where the hash is an 8 character, seemingly random string and the profile name is usually default).

Note: The chrome/ folder and userChrome.css/userContent.css files may not necessarily exist, so you have to create them.

This section only deals with the userChrome.css file which modifies Firefox's user interface, and not web pages.

Change the font

The setting effectively overrides the global GTK+ font preferences, and does not affect webpages, only the user interface itself:

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css
* {
    font-family: "FONT_NAME";
}

Hide button icons

Enables text-only buttons:

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css
.button-box .button-icon {
    display: none;
}

Hiding various tab buttons

These settings hide the arrows that appear to the horizontal edges of the tab bar, the button that toggles the "all tabs" drop-down list, and the plus sign button that creates a new tab.

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css
/* Tab bar */

.tabbrowser-strip *[class^="scrollbutton"] {
    /* Hide tab scroll buttons */
    display: none;
}

.tabbrowser-strip *[class^="tabs-alltabs"] {
    /* Hide tab drop-down list */
    display: none;
}

.tabbrowser-strip *[class^="tabs-newtab-button"] {
    /* Hide new-tab button */
    display: none;
}

Horizontal tabs

To place the tab bar horizontally stacked along the sides of the browser window:

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css
/* Display the tabbar on the left */
#content > tabbox {
    -moz-box-orient: horizontal;
}

.tabbrowser-strip {
    -moz-box-orient: vertical;
    /*
     * You can set this to -moz-scrollbars-vertical instead,
     * but then the scrollbar will *always* be visible.  this way
     * there is never a scrollbar, so it behaves like the tab bar
     * normally does
     */
     overflow: -moz-scrollbars-none;
}

.tabbrowser-tabs {
    -moz-box-orient: horizontal;
    min-width: 20ex;   /* You may want to increase this value */
    -mox-box-pack: start;
    -moz-box-align: start;
}

.tabbrowser-tabs > hbox {
    -moz-box-orient: vertical;
    -moz-box-align: stretch;
    -moz-box-pack: start;
}

.tabbrowser-tabs > hbox > tab {
    -moz-box-align: start;
    -moz-box-orient: horizontal;
}

Auto-hide Bookmarks Toolbar

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css
#PersonalToolbar {
    visibility: collapse !important;
}

#navigator-toolbox:hover > #PersonalToolbar {
    visibility: visible !important;
}

Remove sidebar width restrictions

~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css
/* remove maximum/minimum  width restriction of sidebar */
#sidebar {
    max-width: none !important;
    min-width: 0px !important;
}

Web content CSS settings

This section deals with the userContent.css files in which you can add custom CSS rules for web content. You can import other CSS files by adding to the file:

~/.mozilla/firefox/<profile_dir>/chrome/userContent.css
@import url("./imports/some_file.css");

Block certain parts of a domain

~/.mozilla/firefox/<profile_dir>/chrome/userContent.css
@-moz-document domain(example.com) {
    div#header {
        background-image: none !important;
    } 
}

Add [pdf] after links to PDF files

~/.mozilla/firefox/<profile_dir>/chrome/userContent.css
/* add '[pdf]' next to links to PDF files */
a[href$=".pdf"]:after {
    font-size: smaller;
    content: " [pdf]";
}

Show URLs at the bottom of the screen when hovering a link

~/.mozilla/firefox/<profile_dir>/chrome/userContent.css
a[href]:hover {
    text-decoration: none !important;
}

a[href]:hover:after {
    content: attr(href);
    position: fixed; left: 0px; bottom: 0px;
    padding: 0 2px !important;
    max-width: 95%; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
    font:10pt sans-serif !important;
    background-color: black  !important;
    color: white !important;
    opacity: 0.7;
    z-index: 9999;
}</nowiki>

Block ads

See floppymoose.com for an example of how to use userContent.css as a basic ad-blocker.

Miscellaneous

Other tips and tweaks.

Mouse wheel scroll speed

To modify the default values (i.e. speed-up) of the mouse wheel scroll speed, go to about:config and search for mousewheel.acceleration. This will show the available options, modifying the following:

  • Set mousewheel.acceleration.start to -1.
  • Set mousewheel.acceleration.factor to the desired number (10 to 20 are common values).

Alternatively you can install the SmoothWheel add-on.

Change the order of search engines in the Firefox Search Bar

To change the order search engines are displayed in:

  • Open the drop-down list of search engines and click Manage Search Engines... entry.
  • Highlight the engine you want to move and use Move Up or Move Down to move it. Alternatively, you can use drag-and-drop.

How to open a *.doc automatically with Abiword or LibreOffice Writer

Go to Preferences > Applications and search for Word Document (or Word 2007 Document for *.docx). After finding it, click the drop-down list and select Use other.... From there you have to specify the exact path to the Abiword or Writer executable (i.e./usr/bin/abiword or /usr/bin/lowriter).

Secure DNS with DNSSEC validator

You can enable DNSSEC support for safer browsing.

Adding magnet protocol association

In about:config set network.protocol-handler.expose.magnet to false.

The next time you open a magnet link, you will be prompted with a Launch Application dialogue. From there simply select your chosen torrent client. This technique can also be used with other protocols.

Prevent accidental closing

The Disable Ctrl-Q Shortcut extension can be installed to prevent unwanted closing of the browser.

An alternative is to add a rule in your window manager configuration file. For example in openbox add:

 <keybind key="C-q">
   <action name="Execute">
     <execute>false</execute>
   </action>
 </keybind>

in the <keyboard> section of your rc.xml file.

See also