XmlHttpRequest Debugging for IE · Curiosity is bliss

Curiosity is bliss    Archive    Feed    About    Search

Julien Couvreur's programming blog and more

XmlHttpRequest Debugging for IE

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.

Update (2006/06/08): I just updated the script to also instrument IE7's native XMLHttpRequest object.


That's very interesting. We were just discussing yesterday that it would be really nice to have a latency simulator for ajax on IE. I'll put my vote it for that port!

Posted by: Chris (May 16, 2006 11:10 AM) ______________________________________

Link for Google Suggest is: http://www.google.com/webhp?complete=1&hl=en

Posted by: Eric (June 6, 2006 01:33 PM) ______________________________________

Thanks Eric. I fixed the link to Google Suggest.

Btw, I'm happy to report that I tried debugging the XMLHttpRequest traffic from the new Google Spreadsheet app and it worked nicely, both in Firefox/Greasemonkey and IE.

Posted by: Julien Couvreur (June 7, 2006 01:35 PM) ______________________________________


Sadly it does not work for me. IE shows a 'XMLHttpRequest' is undefined error. :(

Any ideas?

All ready tried reinstalling jscript.



Posted by: war59312 (June 10, 2006 05:44 AM) ______________________________________

This is using IE 6 on WinXP SP2.

Posted by: war59312 (June 10, 2006 05:47 AM) ______________________________________

"Anyways, it's possible to reference this script directly into pages that you're working on, ..."

Please explain more fully!
I added http://blog.monstuff.com/archives/images/XHR-Debugging-IE.html
to my IE favorites. But what exactly do I have to do to get it to reveal XMLHttpRequest activity for a page from another server?

Posted by: Herb (July 13, 2006 02:34 AM) ______________________________________


The direct way of using this script is by bookmarking the special link above:
"Finally, here is a port of the script to run on IE, in the form of a
bookmarklet: __XMLHttpRequest Debugging for IE__."

This is a special link because instead of an http: url it's a javascript: url.

The other way is to include a
<script src="</script>">http:// ...path... /XHR-Debugging-IE.js"></script>
tag in the page that you want to instrument.

Posted by: Julien Couvreur (July 13, 2006 01:32 PM) ______________________________________

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'.

Any help is greatly appreciated.

Posted by: Prasad (July 27, 2006 12:43 AM) ______________________________________

I love XMLHttp,manytimes,it is useful to do what you want to do. can you writ something about XMLHttp?

Posted by: 翻译公司 (August 1, 2006 06:18 PM)
comments powered by Disqus