OpenLayers Blog

All the maps that are fit to blog

Debugging OpenLayers

February 22nd, 2008 by Tim Schaub · 1 Comment

Well, this is really about debugging any web app in a browser. Firebug, obviously, is critical to JavaScript development. Having a full featured debugger makes us a bit less embarrassed about using the term development in conjunction with JavaScript. Alas, the world does not run on Firefox.

Firebug Lite is an acceptable cross-browser solution. In OpenLayers, we include a patched version that works a bit better in IE. While nothing like a debugger, Firebug Lite provides simple command-line access outside of Firefox.
My new favorite for work outside of Firefox is Jash. Especially handy is the little bookmarklet (drag to your bookmarks). Open up a page with a map, click your Jash bookmarklet, and start exploring.  This is particularly nice for remote debugging.
>> map [object Object]
>> map.layers.length
3

Start typing map.getZ and hit tab for completion, see

2. getZoom
3. getZoomForExtent
4. getZoomForResolution

Hit Ctrl-X and mouse over the elements to see the DOM hierarchy. Enter jash.help() for more.

Tags: Debugging

1 response so far ↓

  • 1 Morten // Feb 22, 2008 at 6:59 pm

    Visual Studio 2008 provides the far best debugging environment for IE (and much better than FireBug, which we have to settle with for FireFox). I wish they would make a VS plugin for FireFox so we could get the same debugging environment for FireFox.

    FireBug do have some nice analysis tools that VS doesn’t have, like event tracking on DOM elements, they are not directly debugging related (ie. setting breakpoints, immediate window, runtime object inspection etc).