Greasemonkey script to turn on Firebug debugging for Dojo
Posted by Shane O'Sullivan on January 12, 2007
Enabling debugging in Dojo is a relatively simple thing to achieve, you simply put
djConfig={isDebug:true};
into a script block before including the dojo.js file, and that’s it. If you want to use Firebug to display your debug statements, put the code:
dojo.require(“dojo.debug.console”)
somewhere on the page. However, this is not always as straightforward as it seems. For simple html or PHP pages, sure, it’s easy. But what if you want to debug multiple pages and you’re using static html? You’ll have to put this code on all of them, and remove it when you’re done. Or what, as is the case in my current position, you are working with a very large framework that doesn’t easily allow you to change the template of a page without a long rebuild step?
The solution is to use a Greasemonkey script to enable Dojo/Firebug debugging on any page you visit, or only for pages in a given list of domains (not that this only works for Firefox, poor old IE doesn’t have anything nearly as cool as Greasemonkey available). The steps to use this script are as follows:
- Install Greasemonkey from http://greasemonkey.mozdev.org/
- Install Firebug from http://www.getfirebug.com
- Go to http://userscripts.org/scripts/show/9424 and click the “Install this Script” button. Greasemonkey should prompt you to install it.
That should be all that’s necessary. Now, every page you visit will print it’s debug output to the Firebug console, regardless of whether the page has debugging switched on or not. Obviously you don’t always want this script to run, so to disable it, in Firefox to to “Tools/Greasemonkey/Manage User Scripts”, select the script and uncheck the “Enabled” checkbox whenever you don’t want to use it. Even simpler, if this is the only script you use with Greasemonkey, you can enable/disable Greasemonkey completely by clicking on the monkey icon at the bottom-left of the Firefox window.

William Beh said
Great Stuff.
Pancu said
Anyone knows if there is another script for newer releases of dojo? because this one doesn’t work with dojo 1.0.0
thanks
Shane O'Sullivan said
I haven’t gotten around to updating the script for 0.9/1.0. When I do I’ll post it.
Shane
Ramon said
Any progress here? I get the following displayed in the FF3 error dialog:
Error: dialog1.show is not a function
This has happened on other GreaseMonkey scripts that attempt to create and show a dialog — maybe this is not supported under FF3?
Ramon
Shane O'Sullivan said
Sorry no, it’s been more or less at the bottom of my list. I might get around to it in the next few weeks.
You could have a try at it? It’s not too complex to edit the greasemonkey script
Bruce said
Is this still maintained?
WIth current dojo one sees:
GET http://localhost:8080/mgmt-api/dojoroot/dojo/debug.js
404 Not Found
68ms
dojo.js (line 14)
GET http://localhost:8080/mgmt-api/dojoroot/dojo/debug/console.js
404 Not Found
62ms
dojo.js (line 14)
GET http://localhost:8080/mgmt-api/dojoroot/dojo/debug/Firebug.js
404 Not Found
38ms
Shane O'Sullivan said
unfortunately no, this was written years ago and Dojo has changed a lot since then