O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required


Welcome to Firefox Hacks, the book about the browser. Firefox is the web browser that upholds the highest principles of the World Wide Web. It supports and defines the Web as a good place to be—a place where all people can freely and safely participate, without having to tip their hat to anyone. Those are fighting words.

The Firefox product is made by the nonprofit Mozilla Foundation and its legion of helpers. Firefox is open source software: software that is free and fully exposed to independent scrutiny. Firefox is a poster-child of the open source trend and the one of the first open source products that average computer users try. If you find yourself liking Firefox, then open source has worked for you.

Firefox is more than just a TV screen for the Web, though. It contains extra technical goodies of all kinds. Whether you’re a crusty hacker, a bored web surfer, a contemporary designer, or a frustrated IT professional, Firefox has features to offer you that will make your life easier and more ornamented. Hacking Firefox to meet your needs is what this book is all about.

Why Firefox Hacks?

The term hacking has a bad reputation in the press. They use it to refer to someone who breaks into systems or wreaks havoc with computers as their weapon. Among people who write code, though, the term hack refers to a “quick-and-dirty” solution to a problem, or a clever way to get something done. And the term hacker is taken very much as a compliment, referring to someone as being creative, having the technical chops to get things done. The Hacks series is an attempt to reclaim the word, document the good ways people are hacking, and pass the hacker ethic of creative participation on to the uninitiated. Seeing how others approach systems and problems is often the quickest way to learn about a new technology.

The Firefox web browser is built on the extensive and comprehensive engineering effort that is the Mozilla Project. Although the web browser’s primary task is to display web pages, it is in fact a remarkably flexible, configurable, and complex environment. It is this broader view of Firefox that leads to many fruitful hacking opportunities. You need not accept Firefox exactly as it is without compromise. There is much you can do to tweak the browser to make working with the Web more pleasant, creative, and time-efficient. Feel free to hack Firefox.

How to Use This Book

You can read this book from cover to cover if you like, but each hack stands on its own, so feel free to browse and jump to the different sections that interest you most. If there’s a prerequisite you need to know about, a cross-reference will guide you to the right hack.

Like most books, you can, if you want, start at the front and end at the back. If you know nothing about Firefox at all, the earliest material will ease you into the technology. If you’re a hacker extraordinaire, then leap to the last few chapters where the hard stuff is. Overall, this book has something for everyone, so start with the chapter that’s aimed at your particular needs first.

How This Book Is Organized

Firefox Hacks is divided into nine chapters, organized by subject:

Chapter 1, Firefox Basics

This chapter covers beginner end-user features, without attempting to reproduce the Firefox Help system. It’s a brief tour of the browser from a number of different user perspectives.

Chapter 2, Security

This chapter covers the security arrangements that affect how Firefox interacts with the Web. It describes how to raise and lower security in a number of different ways.

Chapter 3, Installation

This chapter explains how to install Firefox your way, rather than the standard way. It provides installation tactics suitable for a number of lifestyles and organizational settings.

Chapter 4, Web Surfing Enhancements

This chapter explains how to make Firefox work harder for you as an information-gathering tool.

Chapter 5, Power Tools for Web Developers

This chapter examines Firefox as a testing and development tool for web page design. Web developers love Firefox.

Chapter 6, Power XML for Web Pages

This chapter is for more advanced web application projects, where programming or medium-weight XML technology is needed. It describes how to connect content to XML standards and code.

Chapter 7, Hack the Chrome Ugly

This chapter looks under the hood of the Firefox installation and finds that with only a drop of programming energy, you can make major changes to the browser.

Chapter 8, Hack the Chrome Cleanly

This chapter explains how to properly prepare fancy Firefox enhancements, such as extensions and themes.

Chapter 9, Work More Closely with Firefox

Firefox is a complex tool and a building block of the Web. If you hope to modify that building block to suit yourself, then you’ll need help getting started. This chapter describes how to connect to the core technology and the people already involved in its development.

Conventions Used in This Book

The following is a list of the typographical conventions used in this book:


Used to indicate URLs, filenames, filename extensions, and directory/folder names. For example, a path in the filesystem will be written in the form /Developer/Applications. Italics is also used to introduce new concepts and terms.

Constant width

Used to indicate code examples, the contents of files, and console output, as well as the names of variables, commands, and other code excerpts.

Constant width bold

Used to show user input in code and to highlight portions of code, typically new additions to old code.

Constant width italic

Used in code examples and tables to show sample text to be replaced with your own values.

You should pay special attention to notes set apart from the text with the following icons:


This is a tip, suggestion, or general note. It contains useful supplementary information about the topic at hand.


This is a warning or note of caution, often indicating that your money or your privacy might be at risk.

The thermometer icons, found next to each hack, indicate the relative complexity of the hack:


Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: "Firefox Hacks by Nigel McFarlane. Copyright 2005 O’Reilly Media, Inc., 0-596-00928-3.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Enabled

image with no caption

When you see a Safari® Enabled icon on the cover of your favorite technology book, that means the book is available online through the O’Reilly Network Safari Bookshelf.

Safari offers a solution that’s better than e-books. It’s a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at http://safari.oreilly.com.

How to Contact Us

We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). As a reader of this book, you can help us to improve future editions by sending us your feedback. Please let us know about any errors, inaccuracies, bugs, misleading or confusing statements, and typos that you find anywhere in this book.

Please also let us know what we can do to make this book more useful to you. We take your comments seriously and will try to incorporate reasonable suggestions into future editions. You can write to us at:

O’Reilly Media, Inc.
1005 Gravenstein Hwy N.
Sebastopol, CA 95472
(800) 998-9938 (in the U.S. or Canada)
(707) 829-0515 (international/local)
(707) 829-0104 (fax)

To ask technical questions or to comment on the book, send email to:

The web site for Firefox Hacks lists examples, errata, and plans for future editions. You can find this page at:


For more information about this book and others, see the O’Reilly web site:


Got a Hack?

To explore Hacks books online or to contribute a hack for future titles, visit:


With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required