My recent article about Mozilla’s Venkman JavaScript Debugger sparked feedback from TechRepublic members who prefer Firebug for their debugging needs. While I still stand by my recommendation of Venkman JavaScript Debugger, I agree that the freely available Firebug is a great development add-on for Firefox. It provides an integrated tool for monitoring and debugging JavaScript, HTML, and CSS. Here’s a look at Firebug’s features and benefits.

Overview of Firebug

An interesting aspect of Firebug is its tight integration with Firefox. You can open Firebug within the browser or in a separate window. Using it within the browser places Firebug at the bottom of the Web page — a separate instance can be attached to different pages via separate tabs or windows. This allows you to work on more than one page at a time.

The interface has four tabs — HTML, CSS, Script, DOM, Net — that correspond to the various aspects of a page, as well as a Console for errors and log messages. You may select each tab to examine the corresponding page elements.

Working with code

The HTML, CSS, Script, and DOM tabs allow you to peek at the innards of the page’s respective code. The HTML tab presents the page’s HTML elements. You may expand and/or collapse the elements to view and/or hide the child elements. This is true for the JavaScript and DOM tabs as well. This feature allows you to easily drill down into a page’s source code.


Firebug provides a robust debugger for working with JavaScript. You may set breakpoints to halt execution as particular points in a script or set conditional breakpoints to stop execution only if certain conditions are met. In addition, the debugger allows you to step through script one line at a time to closely monitor execution.

While using the debugger, the stack provides a snapshot of the environment at any given moment. This allows you to view variables, as well as monitor the call stack. The watch functionality allows you to watch variables and expressions as code executes. JavaScript code may be inserted into pages to generate debugging data as well. The code profiler allows you to generate a report of function calls and the time consumed by these calls. The debugging features are located in the Console tab.

The Console is one of my favorite Firebug features. It allows you to execute JavaScript on-the-fly; this is useful when you’re developing code, and you have concerns about how a particular line or chunk of code will execute. The autocomplete feature helps you if don’t remember the numerous features of the JavaScript language. In addition to running code, it shows the JavaScript error message log.

The Firebug Console API provides the console variable that you may use in Web page code to generate debugging information as scripts execute. It includes a number of methods to assist with the debugging process, including log, trace, and debug.

Network activity

The Net tab offers a look at the network activity associated with the associated page. It shows all of the downloads related to the page, as well as how long each resource took to download. Requests are color coded to identify those served from cache. Items are served from the cache in a lighter gray, so you can quickly scan and see how effectively your site is using the cache to optimize page load times.

Net includes a set of its own tabs to filter what is displayed — you may list all elements or only HTML, CSS, JavaScript, Images, and Flash elements. The XBR tab allows you to examine HTTP headers and the server response; this is a great option when you’re working with AJAX-enabled applications.

Firebug add-on

A great aspect of open source projects is the contributions of other developers and companies. A good example is the Yahoo! Developer Network’s creation of a Firebug add-on called YSlow. It analyzes a Web site based on Yahoo!’s rules for high performance sites. Given the size of Yahoo!, the rules target larger sites with high traffic, but it may be useful for your application.

Don’t use Firefox?

The Firebug Lite tool provides a subset of Firebug features within browsers other than Firefox such as Internet Explorer, Opera, and Safari. The extension is installed via a JavaScript file that is included in any page that wants to use it. An interesting aspect of open source projects like Firebug is the people and companies that contribute to it. Yahoo! is actively contributing to the Firebug project.

It’s worth the effort

Firebug is a great addition to a Web developer’s toolbox. It provides everything necessary to pull back the covers and take a look at what is really going on within a Web page albeit HTML, CSS, or JavaScript. It can take awhile to learn and adopt new tools, but Firebug is definitely worth the effort if you are a Firefox user.

Tony Patton began his professional career as an application developer earning Java, VB, Lotus, and XML certifications to bolster his knowledge.

Check out the Web Development Zone archive, and read previous editions of Tony Patton’s column.


Get weekly development tips in your inbox
Keep your developer skills sharp by signing up for TechRepublic’s free Web Development Zone newsletter, delivered each Tuesday. Automatically subscribe today!