Debugging JavaScript Using Venkman, Part 1 | WebReference

Debugging JavaScript Using Venkman, Part 1

Debugging JavaScript Using Venkman, Part 1

Most people who do even a little bit of JavaScript programming, even those who are simply tweaking somebody else’s code, are familiar with the rudimentary JavaScript debugger in the recent versions of Internet Explorer. Click on the yellow warning icon in your browser, and you get a listing of various JavaScript errors in your code. It is simple, and for many people it is enough, but it’s not really the type of fully-fledged debugging environment with features programmers have come to expect in other development languages. If you find yourself doing a lot of JavaScript programming or tweaking and you are concerned with cross-browser support for your scripts, then Venkman is worth checking out.

What is Venkman?

Venkman is both a graphical and command-line application for writing and debugging JavaScript code that works directly with any browser based upon Mozilla (i.e. Mozilla 1.x, Netscape 6 and 7 and Firebird). All of the commands available can be executed in either environment and its many features include such things as breakpoint management and call stack inspection, however, the variable/object inspection mechanism is great at finding the most common problems you are likely to run into. There is also a code profiling feature that allows you to measure the relative speed at which your JavaScript executes, and there is even a “Pretty Printing” feature which can automatically re-indent and line wrap poorly formatted code. As a JavaScript development environment Venkman has a lot going for it. However, it is not an editor – it will show you where your code has gone wrong and you can save out the changes that make to your code interactively, but it should not be confused with a complete development environment package.

Venkman first started out as a simple JavaScript debugger devised by Netscape programmer John Bandhauer back in 1998. He converted his original C code into Java in order to provide cross-platform support, and this became the original Netscape JavaScript Debugger 1.0, and later, 1.1, both incorporated into versions of Netscape Navigator 4.x. When a JavaScript debugger was needed for the original Mozilla, programmer Robert Ginda took Bandhauer’s API from the original debugger and built upon it, releasing it as Venkman 0.85, which was first incorporated into Mozilla 1.0.

If you have done a complete install of the Mozilla browser from version 1 onwards, you already have a copy of Venkman installed. An easy way to see if you have it installed is to go to the Tools drop-down menu in the browser, select Web Development and see whether the JavaScript Debugger option is available. Another way is to simply open up a command console (i.e. Start Menu -> Run) and then type in mozilla –venkman to launch it. If you don’t have it you can install it by selecting the Debugger option when doing a custom install of Mozilla. Venkman does not come automatically with versions of Netscape 6 and 7 and you will have to download and install a copy of it. At this time, Venkman is now up to version 0.979 and minor updates occur on a weekly or monthly basis. If you are looking to install the latest-and-greatest version of Venkman, go to its development page on Robert Ginda’s site at: and install the release directly into Mozilla or Netscape using the link provided, and then restart the program (for obvious reasons, you shouldn’t expect this to work in Microsoft’s Internet Explorer). Note that if you are still using Mozilla 1.0 or Netscape 6.x, Venkman’s developers strongly recommend you upgrade to Mozilla 1.4 and Netscape 7.x respectively, as Venkman has been significantly improved and it will not run properly or at all using these slightly older browsers.

Why the name Venkman? It’s actually the codename for this program, but it seems to have stuck, since it’s real name – “JavaScript Debugger” – is, let’s face it, generic-sounding if not downright boring. The name comes from the wily Bill Murray character Dr. Peter Venkman in the Ghostbusters movies. Now you can trap hard-to-track JavaScript bugs in the same way as the onscreen Venkman trapped ghosts.

The initial Venkman screen.

Created: March 27, 2003
Revised: August 12, 2003