Home Web-development Firebug 1.5: Editing, Debugging, and Monitoring Web Pages

Firebug 1.5: Editing, Debugging, and Monitoring Web Pages

By Chandan Luthra , Deepak Mittal
books-svg-icon Book
Subscription
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
Subscription
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Getting Started with Firebug
About this book

With the advent of RIA (Rich Internet Applications), most web pages are driven by a combination of JavaScript, AJAX, CSS, and so on. Web developers and designers find it hard to debug and fix the issues that crop up on the client side. Firebug is a wonderful toolkit to have in your arsenal for handling all such issues. This book covers all of Firebug's features and will help you utilize its capabilities with maximum efficiency. AJAX development and debugging is not one of the easiest tasks; this book explains step-by-step, how to develop and debug AJAX components in your web page in a very easy way, thereby increasing your productivity. Topics like performance tuning of the web page are covered in detail.

This book discusses how to become more efficient in various aspects of web development by using Firebug. It is a very easy-to-understand, step-by-step guide that explains all the features of Firebug with concise and simple examples. With this book in hand, you will be able to deal with the painful areas of web development like JavaScript and AJAX debugging using Firebug.

The book takes you from the basics of Web Development like editing HTML and CSS on the fly to advanced features like AJAX, JSON, Monitoring, and Performance Tuning of web pages. It assumes that you have some very basic knowledge of HTML and JavaScript. For those of you with a sound knowledge of these technologies, this book can help you increase your productivity by using Firebug effectively, taking full advantage of its rich and powerful features and the console API. Towards the end, the book explains how to create your own powerful extensions for the Firebug community. 

Publication date:
April 2010
Publisher
Packt
Pages
224
ISBN
9781847194961

 

Chapter 1. Getting Started with Firebug

In this chapter, we will have a quick introduction to Firebug—its origin and history, who should use Firebug, and a glimpse of Firebug's main features. Hopefully this will spark your interest in both Firebug and the rest of this book. We will also look at how to install Firebug on several browsers and the different modes in which Firebug can be opened.

In this chapter, we will look at the following:

  • What is Firebug

  • The history of Firebug

  • The need for Firebug

  • The capabilities of Firebug

  • Installing Firebug on different browsers

  • Opening and closing Firebug

  • Firebug modes

 

What is Firebug?


Firebug is a free, open source tool that is available as a Mozilla Firefox extension, and allows debugging, editing, and monitoring of any website's CSS, HTML, DOM, and JavaScript. It also allows performance analysis of a website. Furthermore, it has a JavaScript console for logging errors and watching values. Firebug has many other tools to enhance the productivity of today's web developer.

Firebug integrates with Firefox to put a wealth of development tools at our fingertips while we browse a website. Firebug allows us to understand and analyze the complex interactions that take place between various elements of any web page when it is loaded by a browser.

Firebug simply makes it easier to develop websites/applications. It is one of the best web development extensions for Firefox. Firebug provides all the tools that a web developer needs to analyze, debug, and monitor JavaScript, CSS, HTML, and AJAX. It also includes a debugger, error console, command line, and a variety of useful inspectors.

Note

Although Firebug allows us to make changes to the source code of our web page, the changes are made to the copy of the HTML code that has been sent to the browser by the server. Any changes to the code are made in the copy that is available with the browser. The changes don't get reflected in the code that is on the server. So, in order to ensure that the changes are permanent, corresponding changes have to be made in the code that resides on the server.

 

The history of Firebug


Firebug was initially developed by Joe Hewitt, one of the original Firefox creators, while working at Parakey Inc. Facebook purchased Parakey in July, 2007.

Currently, the open source development and extension of Firebug is overseen by the Firebug Working Group. It has representation from Mozilla, Google, Yahoo, IBM, Facebook, and many other companies.

Firebug 1.0 Beta was released in December 2006. Firebug usage has grown very fast since then. Approximately 1.3 million users have Firebug installed as of January 2009.

The latest version of Firebug is 1.5. Today, Firebug has a very open and thriving community. Some individuals as well as some companies have developed very useful plugins on top of Firebug.

 

The need for Firebug


During the 90s, websites were mostly static HTML pages, JavaScript code was considered a hack, and there were no interactions between page components on the browser side.

The situation is not the same anymore. Today's websites are a product of several distinct technologies and web developers must be proficient in all of them—HTML, CSS, JavaScript, DOM, and AJAX, among others. Complex interactions happen between various page components on the browser side. However, web browsers have always focused on the needs of the end users; as a result, web developers have long been deprived of a good tool on the client/browser side to help them develop and debug their code.

Firebug fills this gap very nicely—it provides all the tools that today's web developer needs in order to be productive and efficient with code that runs in the browser.

 

Firebug capabilities


Firebug has a host of features that allow us to do the following (and much more!):

  • Inspect and edit HTML

  • Inspect and edit CSS and visualize CSS metrics

  • Use a performance tuning application

  • Profile and debug JavaScript

  • Explore the DOM

  • Analyze AJAX calls

 

Installing Firebug on different browsers


Firebug is developed as a Firefox add-on and can be installed on Firefox similar to all other add-ons. In order to make Firebug work for non-Firefox browsers, there is a JavaScript available from Firebug that makes available a large set of Firebug features.

Based on your browser version, we can install the corresponding Firebug version.

Firebug version

Browser version

Firebug 1.5

Firefox 3.5 and Firefox 3.6

Firebug 1.4

Firefox 3.0 and Firefox 3.5

Firebug 1.3

Firefox 2.0 and Firefox 3.0

Firebug Lite

IE, Safari, and Opera

Installing Firebug on Firefox

To install Firebug on Firefox, we will follow these steps:

  1. Open Firefox browser and go to https://addons.mozilla.org.

  2. In the search box of the site, type Firebug and hit Enter or click on the Search for add-ons button.

  3. In the search results, click on Add to Firefox button.

  4. A pop up will appear asking whether we want to continue with the installation. We will now click Install now.

  5. After installation is complete, let's restart Firefox.

When the browser comes up, it will prompt us by saying a new add-on has been installed. Now we are all set and ready to play with Firebug.

Installing Firebug on non-Firefox browsers

Firebug is an extension for Firefox, but that doesn't mean it works only on Firefox. What happens when we want to test our pages against Internet Explorer, Opera, or Safari? Firebug Lite is the solution for this. It's a product that can be easily included in our file via a JavaScript call, just like any other JavaScript, to support all non-Firefox browsers. It will simulate some of the features of Firebug in our non-Firefox browsers.

To use Firebug Lite on non-Firefox browsers, we should include the following line of code in our page:

<script type='text/javascript'
  src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'>
</script>

Note

For more information and updates on Firebug Lite, refer to http://getfirebug.com/lite.html

If we don't want to modify the source code of our page and still want to use Firebug Lite on a non-Firefox browser, we can run Firebug as a bookmarklet by creating a bookmark with the value of the URL as the following JavaScript code:

javascript:var firebug=document.createElement('script');
firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');
document.body.appendChild(firebug);
(function()
{
if(window.firebug.version)
	{firebug.init();}
else
{setTimeout(arguments.callee);}
})();
void(firebug);

We can inject Firebug into any page by running the bookmarklet created with the preceding URL.

 

Opening and closing Firebug


Opening and closing Firebug is very easy. We can open as well as close Firebug by pressing the F12 key or by clicking the (bug) icon on the right-hand side of the browser's status bar.

Note

Undock Firebug

By default Firebug opens in a dock view. If we want to open it in its own window, we can accomplish this by either clicking on the icon on the upper right corner of Firebug or by pressing the keys Ctrl+F12.

 

Firebug modes


Firebug can be opened in the following two modes:

  • Dock view

  • Window mode

In the dock mode, the Firebug opens the document in the browser's window while in the window mode the Firebug opens in its own window, which is separate from the browser window.

Dock view

Most often we use the dock view mode of Firebug while developing. In this mode, the inspection and CSS tweaking can be done more easily than in window mode. The advantage of this mode is that the user can view the rendered page while simultaneously working on Firebug.

Window mode

The window mode is useful when we use its Console tab or Net tab. When we execute a large JavaScript code, we expect a large area where we can write easily. Similarly, the results shown by the Net tab require a big screen to examine it easily. Window mode is the best solution in this case.

 

Summary


Firebug is an extremely useful web design and development tool that integrates seamlessly with Firefox. Firebug has a huge worldwide user base along with a very open and thriving eco-system.

We now have an idea of how to install Firebug on Firefox and Firebug Lite on non-Firefox browsers. Installing Firebug is as simple as installing any other add-on or extension of Firefox. We have also seen some of the ways of opening, closing, and undocking Firebug, and learned when to use dock view and when to use window mode for different purposes.

About the Authors
  • Chandan Luthra

    Chandan Luthra is an agile and pragmatic programmer, and an active participant at the local open source software events, where he evangelizes about Firebug, Groovy, Grails, and JQuery. He is a Linux and open source enthusiast. He also involves himself in writing blogs, articles, and is an active member on various tech-related mailing lists. He has developed web apps for various industries, including entertainment, finance, media and publishing, as well as others. He loves to share his knowledge and good coding practices with other team members in order to perfect their development skills. In his free time, he loves to contribute to open source technologies. He also loves to code in JQuery with Firebug, which makes development very easy for him. He is a fond lover of Firebug and has been using it since 2007 and co-authored a book on Firebug 1.5 with Packt Publishing in the year 2010.

    Browse publications by this author
  • Deepak Mittal

    Deepak Mittal is a software developer based in New Delhi, India, and he has been involved with software engineering and web programming in Java/JEE world since the late 1990s. Deepak is a Linux and open source enthusiast. He is an agile practitioner and speaks about open source, agile processes, and free software at various user group meetings and conferences. He has designed and built web applications for industries including pharmaceutical, travel, media, and publishing, as well as others. He loves to explore new technologies and has been an early-adopter of quite a few mainstream technologies of today's world. In early 2008, he co-founded IntelliGrape Software, an agile web application development company focused on Groovy and Grails. At IntelliGrape, he has been occupied with building world class applications on Grails and also mentors and trains other team members. Deepak is a veteran user of Firebug and has been using it since 2006.

    Browse publications by this author
Firebug 1.5: Editing, Debugging, and Monitoring Web Pages
Unlock this book and the full library FREE for 7 days
Start now