There is so much power packed into this little FireFox plug-in. It is truly a revolutionary tool for web developers. Here is a quick and dirty set of its most powerful features.
To get started, open up firebug using F12 or by clicking its icon
in the lower right corner of FireFox. To jump straight to the console and start typing commands you can use the Ctrl+Shift+L keyboard shortcut.

From here you can type commands. Try entering document. This will bring up the document DOM object and you can click on that link to get to the DOM and inspect all of the properties of the document object. A shortcut is also available by typing inspect(document) etc. You can use $ and $$ as in Prototype, such as $(’firebug’) and inspect($$(’.firebug’)). Use the up and down arrows to cycle through command history.
- Use console.log and sprintf formatting commands for debugging.
- Use console.info, console.warn and console.error to set your debugging levels.
- Use console.time to log the time your functions take to run.
- Use the error console to view the stack trace of the errors.
You can download Firebug Lite to make these methods work in Internet Explorer. I recommend that you remove your console commands before you go live.
Try Console logging test using console.log You can use sprintf formatting here.
Try Console Error Levels console.info|warn|error
Try Timer logging console.time|timeEnd
Try Error Stack Traces to see stack trace of the errors

Use the debugger to add breakpoints, debug JavaScript code and step through your code.
There are 3 ways to trigger the debugger:
- Use the debugger command.
- Add a breakpoint by clicking on the line number
- Enable the “Break on All Errors” option for the Script tab.
Try a Deubgger Demo using the debugger command


Use the profiler to record detailed statistics on your Script calls and DOM events. This works very much like macros. To manually start profiling click on the profile button in the Console tab. Then try performing some actions on the page. When you are done click on the profile button again. A report is returned which captures the funtions that were called within that time period.
The report output data can be sorted. Own Time tells you how much time each function call took in milliseconds and as a percentage of the total time which can be useful in finding bottlenecks in your code.
Try Manual Profiler test using the manual profile feature
You can also add profilers to your code via the console.profile(”foo”) - console.profileEnd(”foo”) function calls. This can be great when you want to track down events that happen onload.
Try the Coded Profiler using console.profile|profileEnd command

You can log calls to a specific function call and see what parameters are being passed to it and how many times it is being called. To do this open the script tab, find your function and right click within it. From the popup menu choose the “log calls to “function name”".

Now whenever that function is called you get a nice message in the console along with the parameter values sent to it.
Try the Logged Function test with logged functions

In the HTML tab you can also log events for specific elements. This can be useful when you are creating elements on the fly via the DOM and want to track all the events happening behind the scenes.
The Net tab is quite useful for tracing HTTP request and responses. Network traffic can be filtered by type (HTML, CSS, JS, Images, XmlHttpRequest). The Params tab is very handy and shows you the request parameters in a table format. This is great for tracing your Ajax requests. The issue with this that I found is that once a request is made which leaves the current page you loose the previous pages net events. Maybe a feature for the next version of FireBug?

From the HTML tab you can use the Layout tab to view and edit any element’s offset, margin, border, padding and dimension values on the fly.
In the Style sub tab of the HTML tab you can choose an option to “Show Computed Style” which shows you the final style values of the selected HTML element. Another neat trick is that you can click on any CSS property and edit it inline in real time. You can use the up/down keys and page up/page down keys to change numeric values and see your changes in real time, for example padding etc.
'My Job > Web Tip' 카테고리의 다른 글
| identity 속성 컬럼에 강제로 데이터 넣을때.. - MSSQL (2) | 2009/04/29 |
|---|---|
| MSSQL 특정단어가 포함된 프로시저 찾기 (2) | 2009/04/23 |
| FireFox FrieBug 사용법 (0) | 2009/02/20 |
| 성능 및 스타일 향상에 도움이 되는 28가지 ASP 팁 (0) | 2009/02/19 |
| 소셜 추천 사이트 "위지아" (4) | 2008/05/28 |
| Web2.0 OPEN API List (0) | 2008/04/24 |