Firebug Tutorial – Overview of Firebug
September 8, 2007
A few words from me
It has been over 1 year that I’m using Firebug in web development. I found it very useful. I’m really thank to SangSing who introduces me about Firebug. I used to encourage a lot of my techie friends to use Firebug but they said that they don’t know how to use it. They told me that they wanna get something that include all features of firebug and examples. I googled a lit bit but I didn’t find nice resources that covers everything about firebug. So, I decided to write this tutorial. I will try to cover all features of firebug as much as I can. I will show each features with sample sourcecode and screenshot if it required. Don’t hesitate to contact me if you have any suggestion or comment.
There are 5 sections in this tutorial.
Section 1: Overview of Firebug : An introduction of Firebug and feature lists, how to install it and a few notes
Section 2: Logging, Tracing and CommandLine : Everything related to Console tab. An introduction of CommandLine windows which is the same as Immediate windows or Watch window from Visual Studio.
Section 3: HTML DOM Inspector and HTML CRUD operation : This section will tell you about what HTML inspecting is, how to inspect the HTML element, why it is useful and etc. I will also show you how to create/update/delete the HTML DOM dynamically in HTML tab.
Section 4: Javascript debugging with Firebug : This section will cover everything about javascript debugging which is the most famous feature of Firebug. It will also show you how to use Console tab while debugging the Javascript.
Section 5: CSS, DOM and Net Tab : (I haven’t decided whether I should write about them in one section or not. )
As I said above, I will try to cover as much as possible. If I miss out something in this tutorial, please let me know. I appreciated it.
Getting Started : Overview of Firebug
Note: I will cover some basic understanding about firebug and its features, installation and a few screenshots in this section. So, if you already have some ideas about Firebug, you may probably skip this section.
What is Firebug?
Firebug is one of the most popular Mozilla Firefox’s extensions (a.k.a addon). It is also a tool that make the web developers’ life easier. It includes a lot of cool features such as debugging, HTML inspecting, profiling and etc which are very useful for web development.
Features
- Javascript debugging
- **Javascript CommandLine
** - Monitor the Javascrit Performance and XmlHttpRequest
- **Logging
** - Tracing
- **Inspect HTML and Edit HTML
** - Edit CSS
Where to get Firebug Addon?
- Go to the official firebug website http://getfirebug.com .
- There is the image as below at the right-side of the firebug website. Click this image to install.
- The following dialog will be shown after clicking the image above. Click to “Install Now” button.
- After the installation is completed, you need to restart the browser.
Screenshots
Main Menu (under “Tools” Menu)
“Firebug” and “Error Console” menu will be shown under “Tools” menu of Firefox.
- Firebug : It is just a placeholder for Firebug’s submenus.
- Error Console : If you click this menu, one console window will be launched with the list of errors, warnings and message. Actually, this error console is the same as the console tab from Firebug console.
Firebug Menu
If you click “Firebug” menu under “Tools”, the following submenus will be shown.
- Open Firebug : Open the firebug console within the browser. If you don’t wanna click this menu, you can simply press “F12′ to open the firebug console.
- Open Firebug in New Window : Open the firebug console in separated window.
- Disable Firebug : It is for disabling firebug. This option is very important. You should disable the firebug if you don’t need it because If you don’t disable the firebug, it might be a lit bit slow to surf the Ajax-enabled websites like GMail.
- Disable Firebug for **** : You can disable the specific website instead of disabling the whole firebug.
- Allowed Sites : You can add the list of website that you want to surf with Firebug enabled option.
- Inspect the Element : This menu is for inspecting the HTML element. Please read more about this in section 3.
- Profile Javascript : This option is available in Firebug enabled mode only. It is used for monitoring the execution of javascript code. This option is really useful when you have performance issue with your code. Please read more about this in Section 4.
- Clear Console : Clear the console tab of Firebug console.
- CommandLine : Open the console tab
- Search : Set the focus to the Search textbox of current tab.
Content Menu
There is only one menu called “Inspect Element” in content menu. This menu is very useful. Please read more about this in Section 3.
Firebug Console
The picture below is Firebug console.
It contains six tabs such as Console tab, HTML tab, CSS tab, Script tab, DOM tab and Net tab.
- Console tab : It is for logging, profiling, tracing and commandline.
- HTML tab : It is for inspecting HTML element, editing HTML and changing the stylesheet at runtime. CSS, Layout and DOM console are already included as the subtabs.
- CSS tab : You can check how many css file included in the webpage easily. You can simply select the CSS file that you like and you can made the changes to that file on the fly. (I don’t use that tab that much since the same one is already included in HTML tab. )
- Script tab : It is for debugging Javascript code. Watch and Breakpoints consoles are the subtab of Script tab.
- DOM tab : It is for exploring DOM. (I don’t use that tab that much. Instead, I used to use DOM tab from HTML console and Script tab.)
- Net tab : It is for monitoring network activities. It helps you to know why your page (or a particular webpage) is taking so long to load in the browser.
Status Bar
You will see the green cycle if there is no error on your page.
You will see the red cycle and the count of errors if there is some errors in your page.
Keyboard and Mouse Shortcuts
F12. I used to use only F12 to open/close the Firebug console.
If you wanna read the completed list of shortcuts, you can check-out here.
Problem?
Please check-out this FAQ page.
If you still have problems, you drop a comment in my blog. I will reply as soon as possible. Or you can probably contact with Firebug User Group.
Conclusion
That’s all. :) I think you now have some ideas about what firebug is, how it looks like and how to install. If you are already familiar with firebug, this section will be too plain for you since I didn’t put anything new in this section. I will tell you more details about each tab in next section. So, come back tomorrow!!
Feel free to let me know if you have any idea or comment about this tutorials. Your comment will make this tutorials better. I appreciate it.