FireFox users have a wealth of free browser addons that really help make the browser a strong development and debugging tool. Unfortunately those nifty FireFox addons aren't always helpful when a page renders incorrectly in IE. What to do? Well, use an IE addon, of course! A worthy (and free) addon for IE is the DebugBar from Core Services...
Browser Addons
Normally I'm against installing too many IE browser addons beyond the ubiquitous Adobe PDF Reader and MacroMedia Flash addons. I'm especially irritated by the majority of "toolbar" offerings. Yahoo! Toolbar, Google Toolbar and all the like are easy to find and install but can sometimes be more trouble than they're worth. Many toolbars can get in the way of browsing by shear virtue of being installed -- they may slow things down, cause errors, introduce Adware and pose security risks. Fortunately there ARE some toolbars that are worth having around, especially for developers. The IE Developer Toolbar and IE Fiddler PowerToy (also available as a standalone application) are two good examples. For this post, though, we're going to look at a free IE addon called DebugBar.
DebugBar
In terms of features, DebugBar is very similar to the IE Developer Toolbar. DebugBar's layout and use is a bit different and, in many cases, better than the IE Dev bar. The complete feature set is too large to cover in a single blog post but I'll highlight four of the more useful features offered.
DOM View (default view)
The first view you see in DebugBar is the DOM view (DOM = Document Object Model). This view allows you to select a page element and see the element's HTML as well as it's placement within the HTML for the entire page. You can browse all page elements within the page through a tree view. To select an element, simply drag-and-drop the "target" icon from the DebugBar menu area onto the web page element. Screenshot #1 shows an example of selecting a TABLE cell element (TD) in a page from the DotNetNuke.com forums:

SCREENSHOT #1 (click to open full size image)
We can see in Scrrenshot #1 that the upper panel of the DebugBar shows our selected TD (the TD containing the text "Today @ 12:25 AM") and its position within the overall DOM using a treeview. The lower panel shows the actual HTML that defines the TD as well as the inner HTML contained within the TD's opening and closing tags. Compared to using "View Source", the DOM browser is a handier way to inspect page code and verify that rendered HTML matches expectations. This is particularly useful for tracking down empty page elements that cause unexpected gaps and spaces in the rendered page.
Target Tool: Style Inspector
You can target a page element and DebugBar will show you all the style declarations affecting that element. What's more, you'll be told what linked CSS files the declaraions come from. Ok, no big deal - IE Dev bar does the same thing. Debug bar, though, will also give you inheritance information. DebugBar also provides a consolidated, formatted and color-coded view of the relevant style definitions as shown in Screenshot #2:

SCREENSHOT #2 (click to open full size image)
Looking at the full size image, we can see that the STYLE tab is selected and we see three style rules displayed. The first two rules are defined in the skin.css file (we're even given the complete path to the file) and the last rule comes from the default.css file from the "_default" directory within our "Portals" directory.
You can immediately see how nice it is to see all relevant CSS rules in one place as well as where each of those rules were defined. This makes tracking down CSS-related issues a breeze.
Target Tool: Layout Diagram
The next tab we'll look at is the "Layout" tab. This is pretty simple: you get a visual diagram of layout properties for whatever page element you currently have "targeted". You can see layout values at a glance instead of looking through CSS code for attributes such as "padding", "margin", "border", "top", "left", etc. Screenshot #3 shows the Layout view:
SCREENSHOT #3 (click to open full size image)
Looking at the Layout view, we see that the selected element has a defined width of 387 and a height of 132. There is no border, no TOP or LEFT (offset values), no margins, etc. Note that this is the SAME ELEMENT selected from Screenshot #1. You can see from Screenshot #1 that there are quite a few CSS rules being applied to this element. The Layout view gives us an easy way to filter down to CSS rules pertaining to element placement without wading through every style definition.
Script Browser and JavaScript Console
Ah, JavaScript. How I love and sometimes loathe thee. More and more developer tools are supporting JavaScript these days, providing improved features for both coding and debugging. There is still a lot of room for improvement, and to this end, DebugBar offers a step in the right direction. The Script view provides a list of every JavaScript function available to the current webpage. That is, every function from every linked library or defined inline on the page, whether the function has been called by the page or not. Screenshot #4 shows the Script view:

SCREENSHOT #4 (click to open full size image)
In Screenshot #4 we see the Script view with a list of JavaScript functions that have been loaded for the current page. For this example I've selected (in the top panel) a function "spm_fixUnit". We see the code for that function in the center panel of the DebugBar. The bottom panel provides a JavaScript console. In this example I've used the console to execute a JavaScript command: I set an ALERT box with the results of calling the "spm_fixUnit" function with a text value of "50". The result of that call is shown in the popup window. DebugBar not only gives us an easy way to see all JavaScript funcitons loaded for a page, but also the code for each function and a console to let us try things out in real time on the active webpage.
Other Features
There are a number of other simple-but-helpful tools contained within DebugBar. Most of these tools are freely available in other addons but having all of the tools together prevents you from having to install multiple addons. A few examples:
- Window resizer.
Use this to resize your browser window to common screen resolutions. This is a fast and easy way to see what your webpage looks like at different screen resolutions without actually changing YOUR resolution or resorting to using two different monitors or systems.
- Color picker.
Highlight a page element, get its color value and copy the hex color value to the clipbaord in a single step.
- Highlight in page.
Highlight all instances of an entered word or phrase in the current page.
More Info and Where To Download
If you've never used a developer-oriented toolbar before, the free DebugBar is a great place to start. You can read more about it and download a free copy here: http://www.debugbar.com
The IE Developer Toolbar (Beta 3) offers many of the same DebugBar features but with a different interface. Note that many features from the IE Dev bar will be integrated into the Internet Explorer 8 browser. IE6 and IE7 users can get those features now via the Dev bar.
Read about and download the free IE Dev bar (beta 3) here:
http://blogs.msdn.com/ie/archive/2007/01/09/ie-developer-toolbar-beta-3-now-available.aspx
Read about the dveloper tools integrated into IE8 here:
http://blogs.msdn.com/ie/archive/2008/03/07/improved-productivity-through-internet-explorer-8-developer-tools.aspx
The Fiddler PowerToy can be had in a standalone version (Windows application) here: http://www.fiddlertool.com/fiddler/
The standalone version of Fiddler is more useful than the browser plugin since you can use it with any browser or web-aware application.