A note about synchronous xmlhttp requests and Firefox

Since I just spent the better part of Friday debugging this problem and then the better part of Friday night Googling for a work around, it’s worth noting that there is a “bug” in the Firefox implementation of the xmlHTTPRequest object when using it for synchronous calls (i.e. the rest of the script pauses and waits for the request to complete, unlike typical asynchronous AJAX calls). When using the xmlhttp object in a synchronous fashion, Firefox does not process the onreadystatechange handler. Thus, any libraries that are dependent on this (for running post processing functions for example) will fail to work under these conditions. Interestingly, having the Firebug extension installed causes the object to behave properly. So a secondary note is to always test your apps in a “clean” instance of Firefox.

Here are the details that I came across, along with a work around: Lukav’s Weblog » Blog Archive » Firefox firebug and synchronos calls problem.

I’ve also set up a set of tests to demonstrate the problem. Try in both Firefox and IE to see the differences.

* This post was originally published on June 5, 2007 at http://www.csb7.com/blogs/whyblogwhy/2007/06/05/a_note_about_synchronous_xmlhttp_request

When we die, we may be set to write an essay on our life story. Fifty years behind a desk will be summed up in a few paragraphs while a few days in the wilds will expand into the story.

— Stephen Graham