Julien Couvreur's programming blog and more

XmlHttpRequest Debugging for IE

12 May 2006

Since I wrote the original XMLHttpRequest Debugging user script for Firefox (screenshot), almost a year ago, it has received a lot of positive feedback and a number of you expressed interest in having the tool support IE, to ease your AJAX development.
Finally, here is a port of the script to run on IE, in the form of a bookmarklet: XMLHttpRequest Debugging for IE.

To use it, add the link to your favorites (ignore the security warning), go to a page you'd like to troubleshoot or analyze (such as Google Suggest) and open the bookmarklet. From there, the experience is mostly the same as with the original user script for Firefox.

The main limitation in this version is that you will get an error message if the page you're instrumenting uses any other ActiveX object than XMLHttp. This is because the bookmarklet replaces the ActiveXObject constructor as a whole, emulating the construction of XMLHttp objects, but doesn't know how to construct other types of objects.Update (2006/05/15): Just updated the script and this limitation should be gone now. I updated the demo page (see link below) with a simple XMLDOM test case that I used to test this.

I haven't tested it that much yet, so please feel free to report any errors you run into back to me and I'll do my best to get it fixed. My email is on the help pane of the tool and the front page of this blog.

Just like my recent port of the Javascript Shell for IE, most of the code (XHR-Debugging-IE.js) actually resides on the server, rather than inside the bookmarklet itself. That's not great, but I don't know another workaround for IE's bookmarklet length limitation...
Anyways, it's possible to reference this script directly into pages that you're working on, as this simple demo shows, to avoid having to open the debugging console over and over.
This should also allow tracing earlier in the page lifecycle, catching the initial XMLHttpRequest calls. To achieve that, the script needs to be loaded after the page is loaded but before the first instantiation of an XMLHttpRequest object.
The script also includes some notes on what differs from the Firefox/Greasemonkey version, if you're interested in the technical details.

Similarly, it should be possible to convert some of my other AJAX-related user scripts, such as XMLHttpRequest - Add Latency. Let me know if you'd be interested in an IE version of this tool.

Thanks a lot for the tools. I have a problem with xmlHTTPRequest object and hope you could solve that.

I'm making a call using xmlHTTPRequest object to a secure page, from a non-secure page. Both pages are in the same domain. At the xmlHTTPRequest.open method, I'm getting the error 'Unhandled exception, permission denied to call method xmlhttprequest.open'.