Firefox

From ArchWiki
Revision as of 06:22, 27 October 2009 by Gog (Talk | contribs) (Recompiling)

Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Firefox is an open-source graphical web browser from Mozilla. The Firefox package in Arch Linux is compiled without official branding, which means that when Firefox is started it will use an alternate icon and will be named after its release series' codename. This has to be done because a distribution may use the name "Firefox" and its artwork only if there are no unofficial modifications, including security patches.

Enabling Firefox Branding

There are a few ways to enable official branding and to change the browser's user agent string. Among them, there is recompiling, modifying the browser with add-ons, or using the advanced configuration (Template:Codeline). Please note that distributing a version with official branding without previous approval from Mozilla is against the law.

Recompiling

The following procedure is for the 2.x version of Firefox. A branded version of Firefox 3.x is available in the AUR. This guide will employ ABS for rebuilding Firefox.

After installing ABS,

# pacman -S abs

sync the ABS tree.

# abs

If this is the first time running abs, it may take a while to sync the package tree. Subsequent runs will be much faster. Now perform the following:

$ mkdir -p ~/devel/abs/firefox
$ cp -r /var/abs/extra/firefox ~/devel/abs/firefox
$ cd ~/devel/abs/firerfox

Use an editor of choice to open the mozconfig file. Add the following line to the end:

ac_add_options --enable-official-branding

Save and exit, then run:

$ makepkg -g >> PKGBUILD

This command copies the md5sum values of modified source files (mozconfig in this case) to the PKGBUILD.

Edit the PKGBUILD file by replacing this line

convert ${startdir}/src/mozilla/browser/app/default.xpm ${startdir}/pkg/usr/share/pixmaps/firefox.png

with the following:

convert ${startdir}/src/mozilla/dist/branding/default.xpm ${startdir}/pkg/usr/share/pixmaps/firefox.png

Now scroll down and look for these two lines.

install -m644 ${startdir}/src/mozilla/browser/app/default.xpm ${startdir}/pkg/usr/lib/firefox/chrome/icons/default/
install -m644 ${startdir}/src/mozilla/browser/app/default.xpm ${startdir}/pkg/usr/lib/firefox/icons/

Replace them with the following:

install -m644 ${startdir}/src/mozilla/dist/branding/default.xpm ${startdir}/pkg/usr/lib/firefox/chrome/icons/default/
install -m644 ${startdir}/src/mozilla/dist/branding/default.xpm ${startdir}/pkg/usr/lib/firefox/icons/ 

Save and exit, then run:

makepkg -s

This will install the required packages for building Firefox prior to making the package itself.

Once it has created the package, remove the currently installed Firefox version, if any:

pacman -Rd firefox

Then install the newly created version with:

pacman -U firefox-*.pkg.tar.gz

Advanced Configuration

Enter Template:Codeline in Firefox's address bar to access the advanced configuration options. In the filter, enter Template:Codeline. This will show the current user-agent string, which can be modified as desired. Leave the version part of the string unaltered, and replace Template:Codeline with "Firefox" in order to make the browser identify itself with the traditional user-agent string.

Branding without recompilation

To brand "Shiretoko" without recompiling the whole browser, it is required to replace the Bon Echo icons with the official Firefox icons, and change the string "Shiretoko" in a few files. The firebrand script takes care of this (see note in bold in the initial thread post). Run it (as root) after an upgrade or installation of firefox. To revert to the Shiretoko brand again, simply reinstall firefox. The script will by default download the icons every time it is run. To "cache" the icons locally for later firefox upgrades, set the Template:Codeline variable to a suitable directory, for instance:

NEWICONSDIR=/usr/local/share/firebrand

Recommended Add-ons

Before you try to install add-ons, make sure that your /tmp directory was created with the right permissions. If addons won't install, chmod 1777 /tmp should fix it.

Highly effective ad and popup blocker with lots of options and a simplistic UI.
Download all the links, movies and audio clips of a page at the maximum speed with a single click. Very powerful, lightweight and reliable external download manager.
Selectively blocks javascript, flash, and other types of content. Allows active content to run only from trusted sites, and protects the system against XSS and Clickjacking attacks.
Allows launching an embedded video from a website in an external application. Good for those who have problems with media plugins.
Allows customizing every aspect of Firefox. Title bar, user agent, icons, about graphic, and more.
Adds a menu and a toolbar button to switch the user agent of the browser.

Plugins

To find out what plugins are installed, enter about:plugins in the Firefox address bar.

Flash

# pacman -S flashplugin

In addition, it may be needed to install ttf-ms-fonts ({{Codeline|pacman -S ttf-ms-fonts}) for flashplayer to render text properly.

MPlayer

MPlayer's multimedia plugin is one of the most mature. This will generally cover the majority of online video codecs.

# pacman -S mplayer-plugin

Gecko Media Player

A good replacement of the now aging mplayer-plugin, is Gecko Media Player. More stable combined with MPlayer 1.0RC2. (No more crashes with Apple Trailers.)

# pacman -S gecko-mediaplayer
Note: Be sure to remove mplayer-plugin if already installed.

Totem-plugin

The totem plugin might be the choice for those seeking a gstreamer based plugin:

# $pacman -S totem-plugin gvfs

Java

Note: Each Java package described here contains the Java runtime as well as the fitting browser-plugin for Firefox.
# pacman -S openjdk6

Or install the proprietary version of Java:

# pacman -S jre

Keep in mind that the open-source and closed-source versions can not be installed in parallel. The open-source version is nearly perfect at the time of writing and there is mostly no need anymore to install the proprietary version of Java.

Citrix

See Citrix how-to

Adobe Reader

Licensing issues prevent Acrobat Reader from being available in any repository. It can only be found in the AUR.

32-bit AUR package: Template:Package AUR

It installs the Acrobat Reader application as well as the Firefox plugin. Note however that hardware assisted rendering is unavailable under Linux (at least using a Geforce 8600GTS with driver version 185.18.14).

For 64-bit installs: Adobe Reader is a closed-source application, meaning that users desiring a 64-bit binary have no other choice other than to wait for official support. Workarounds to be considered:

  • Follow this guide posted in the forums: this link. It involves creating a chrooted environment that could be reused for other 32-bit only applications.
  • Or, simply get the 32-bit binary along with the 32-bit dependencies. Install Template:Package AUR. Also, consider installing the extra font packages suggested by the package. Be advised that the Firefox plugin cannot be used directly with this binary - it will not load in the 64-bit browser. Template:Package AUR is required to load the plugin. Finally, be sure to run:
$ nspluginwrapper -v -a -i

as a normal user. This checks your plugin directory and links the plugins as needed. Everything should work as expected now.

Troubleshooting Plugins

Plugins are installed but not working

If Firefox is not using the plugins after installing them (verifiable by typing about:plugins in the adressbar and hitting return.), the problem is most likely erroneous permissions. Fix those with:

# chmod -R 755 /usr/lib/mozilla

After restarting Firefox plugins should function correctly.

If the above suggestion does not fix anything, and about:plugins still reports that no plugins are installed, run the following command (replace the version in the path with the appropiate one):

# ln -sv /usr/lib/mozilla/plugins /usr/lib/firefox-3.0/plugins

Restart firefox and about:plugins should list all of the currently installed plugins.

Another common problem is that the plugin path is unset. This typically occurs on a new install, when the user has not re-logged in before running Firefox after the installation. Test if the path is unset:

$ echo $MOZ_PLUGIN_PATH

If unset, then either relogin, or source Template:Filename and start Firefox from the same shell:

$ . /etc/profile.d/mozilla-common.sh && firefox

Plugins cannot be downloaded

In some cases, users are not able to download (and install) any of the Firefox plugins. The solution is adding the following line in Template:Filename:

64.50.236.214   releases.mozilla.org

Tips

Recommended readings:

Enable Spell Checking

Right click in any text entry field and add the dictionary for the solicited language. Restart firefox, and click in a text entry field again to enable spell checking.

Wheel Mouse Scroll Speed

To modify the default values (i.e. speed-up) of the wheel mouse scroll speed, type the following into Firefox's address bar:

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 True
  • 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.

Speed-Up Firefox by Defragmenting the Profile's SQLite Databases

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

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 sqlite3 Template:Codeline and Template:Codeline commands in the profile directory.

Example:

$ cd ~/.mozilla/profile/9jdn39sdjk.default
$ sqlite3 urlclassifier3.sqlite 'VACUUM;'
$ sqlite3 urlclassifier3.sqlite 'REINDEX;'
$ sqlite3 places.sqlite 'VACUUM;'
$ sqlite3 places.sqlite 'REINDEX;'

Sample Size Differences Comparison

SQLite DB Size Before Size After  % change
urlclassifier3.sqlite 37 M 30 M 19 %
places.sqlite 16 M 2.4 M 85 %

To automate the process for all the databases in all the profiles directory, use the following:

for i in `find ~/.mozilla -name \*.sqlite`; do sqlite3 $i vacuum; done
for i in `find ~/.mozilla -name \*.sqlite`; do sqlite3 $i reindex; done

Cache Your Entire Profile into RAM via tmpfs

If the system has memory to spare, Template:Codeline can be used to cache the entire profile directory, which might incur in increased Firefox responsiveness. Full list of possible benifits include:

  • Reduced disk read/writes (ideal when using a SSD)
  • Better user experience through heightened responsive feel
  • Many operations within Firefox become instantaneous (quick search, history, etc.)

See Speed-up Firefox using tmpfs for more information

Lighten, Speed-up Firefox / Fix fonts and controls issues

Also, font fix for Mozilla suite

Add:

export MOZ_DISABLE_PANGO=1

to ~/.bash_profile and relogin for the change to take place.

General Troubleshooting

Middle-click errors

! The URL is not valid and cannot be loaded.

Another symptom is that middle-clicking results in unexpected behavior, like accessing a random webpage.

The reason stems from the use of the middle mouse buttons in UNIX-like operating systems. The middle mouse button is used to paste whatever text has been highlighted/added to the clipboard. Then there is the possibly conflicting feature in Firefox, which defaults to loading the url of the corresponding text when the button is depressed. This can be disabled like so:

Open the browser, and type the following into the address bar:

about:config

Search for middlemouse.contentLoadURL and set it to false.

Alternatively, having the traditional scroll cursor on middle-click (default behaviour on Windows browsers) can be achieved by searching for general.autoScroll and setting it to true.

Backspace does not work as the 'Back' button

As per this article, the feature has been removed in order to fix a bug. Follow the next steps to retain the original behaviour.

Open the browser and type the following address:

about:config

Search for browser.backspace_action and set it to 0 (zero).

Firefox does not remember login information

It maybe cause of a corrupted Template:Codeline file in Firefox's profile folder. In order to fix this, just rename or remove the cookie.sqlite while Firefox is not running.

Open a terminal of choice and type the following:

$ cd ~/.mozilla/firefox/xxxxxxxx.default/
$ rm -f cookies.sqlite
Note: xxxxxxxx represents a random string of 8 characters.

Restart Firefox and see if it solved the problem.

Broken websites / input fields with dark Gtk Themes

When using a dark GTK theme, one might encounter Internet pages with unreadable input and text fields (p.e. Amazon - white text on white background). This can happen because the site only sets either background or text color, and Firefox takes the other one from the theme.

A work around is to explicitly setting standard colours for all web pages in Template:Filename.

The following sets input fields to standard black text / white background; both can be overridden by the displayed site, so that colors are seen as intended:

input {
    background-color: white;
    color: black;
}

textarea {
    background-color: white;
    color: black;
}

This will force the colours ("Allow paged to choose their own colors [..]" setting, in the Preferences > Content > Color dialog):

input {
    background-color: pink !important;
    color: green !important;
}

textarea {
    background-color: pink !important;
    color: green !important;
}

Change color values to suit, or use an add-on like Stylish.

File Association Problems

For non-GNOME users, Firefox may not associate file types (in the "Open With" part of the download dialog). Installing Template:Package Official ammends the problem:

pacman -S libgnome

Fonts

DPI

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.

Font Replacement

Another way to improve how fonts look is to replace them with another. Add to, or create a Template:Filename file with the following:

<match target="pattern" name="family" >
    <test name="family" qual="any" >
        <string>Helvetica</string>
    </test>
    <edit mode="assign" name="family" >
        <string>Bitstream Vera Sans</string>
    </edit>
</match>

The first font name is the one being replaced, whereas the second is the replacement font.

For more information on font configuration, please read Xorg Font Configuration

Projects Related to Firefox

Firefox Derivatives

  • Iceweasel - The name of two different Firefox forks. One was a GNU project; the name of this project has since changed to Icecat. The second is being developed by Debian and is based on 2.0. At the time of writing the AUR only has Icecat.
  • GNU/IceCat - formerly known as GNU IceWeasel, is a web browser distributed by the GNU Project. IceCat, which is made entirely of free software, is a fork of Mozilla Firefox. It is compatible with the GNU/Linux operating system and almost all of Firefox's addons. GNU/IceCat really can fully replace Firefox.
  • Swiftfox - An optimized and processor-specific build of Firefox. Currently available via AUR. It should be noted that, considering Arch Linux has ABS, you could build your own optimized build of Firefox.
  • Swiftweasel - Mostly like Swiftfox, but the binaries aren't under proprietary license. Some PKGBUILDs are available in AUR.

Firefox Alternatives

A closed-sourced full-featured web suite.
GNOME's default web browser. Uses the same rendering engine as Firefox.
KDE's default web browser. Uses the KHTML rendering engine.
A very lightweight web browser.
The continuation of the original Mozilla suite. Includes web browser, email client, etc.
A webkit-based GTK+ browser. Lightweight and early in development, but with plenty of features already.
A webkit-based Qt browser in development, very capable and fast.
A lightweight webkit browser following the UNIX philosophy; to do one thing and do it well.

External Links

A dated article comparing popular browsers' performance.
An account of the trademark issues from the Firefox package maintainer for Debian.
Official website for the GNU Mozilla forks.