O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #76. Spy on Chrome with the DOM Inspector

Put a microscope to the XUL that makes up the browser chrome with the DOM Inspector.

If you want to hack the existing Firefox chrome, that means building on someone else's work. There's usually no time to study all that code at length, so shortcuts are required. The DOM Inspector is a fast jumping-off point that lets you detect the relationships between different chrome files. It's a good starting point for most of the hacks in this chapter. This hack explains how to get started.

Inspecting XUL

The DOM Inspector is most commonly used to examine HTML pages [Hack #53] . However, it can also be used to inspect the XUL chrome content of any Firefox, Mozilla, or extension window. A small catch is that the DOM Inspector recognizes only windows opened after the inspector was started, plus the initially opened browser window. If some other window is of interest to you, this simple but ungraceful solution is required:

  1. Start Firefox.

  2. Open the DOM Inspector using the Tools menu.

  3. Go back to the initial browser window.

  4. Open a new browser window, or whatever window is required for inspection. Ideally, it should have a meaningful title displayed in its titlebar.

  5. Using Alt-Tab or otherwise, change focus back to the DOM Inspector. You can do this even if the window to be inspected is a modal window.

  6. In the DOM Inspector, choose FileInspect a Window and pick the window desired.

If the normal browser window is inspected using this technique, the top of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required