Debugging Dojo on IE

This took me a few days to figure out so I thought I'd share it...

I had written some code and everything worked fine in Firefox but in IE7 and IE8 I got a JavaScript error:

loader.js: "Could not load 'dojox.gfx'; last tried '../dojox/gfx.js'"

Like a good debugger, I had set isDebug:true in my djConfig but unfortunately neither the IE JavaScript error message nor the IE Developer Tools (Shift+F12 in IE8) told me much. I Google'd the problem and discovered this was a generic error that could be the result of a lot of different problems. Great...just what I needed...

I spent days debugging loader.js using JSLint, changing baseUrl, altering IE security settings, troubleshooting my Apache configuration, altering my VirtualBox get the idea. Finally, I stumbled across bug fix #5398 that mentioned debugAtAllCosts. Hmmm...that's interesting. I wonder what that does? I replaced isDebug:true with debugAtAllCosts:true and voila!, the IE JavaScript error now magically pointed to vml.js, not loader.js, allowing me to track down the problem: a missing semi-colon in my code! (arrrgghhhh....)

So, bottom line, use debugAtAllCosts in djConfig instead of isDebug!

P.S. Another issue that catches me every now and then is page caching. In IE, make sure to go to Tools > Internet Options > General (tab) > Browsing History (section) > Settings (button) and select the Every time I visit the webpage radio button.


Post a Comment

Keep it clean and professional...