IE and XMLHTTPRequest overrideMimeType dilemma

“Bummer! and IE does it again!!!” I thought, actually that was the first thought that came to my mind and boy was i right about it. I should have been accustomed to all this intricacies and little nuggets here and there, which IE tends to reveal once more often than not.

I will tell you what hit me this time, its the ubiquitous XMLHTTPRequest, that small piece of function which is the forerunner of all things magic about AJAX in HTML5. I tell you, its a very simple problem, now i have a servlet which spits out some response for all the world to consume. When I say “I have” it is not “I Have”, it is like “I have access to”, because I cannot change the output, OK?, right!.

But now i am able to connect and receive the response, we are very fine till here, no problems (I can see it in fiddler, so i am not lying about that). But the problem is I am not able to access the information in javascript, the data is truncated. Why? i tell you why, because the response is a delimited string, delimited using null terminator (that’s how it is :().

Rummaging through the web i found that there are problems with AJAX when the response contains a null terminator, but which can be overcome by overriding the mime type for the AJAX response, using “xmlHttpReq.overrideMimeType” function, but guess what the IE doesnt support the function. I ask you why? why wouldnt IE support it? Its more than I can fathom, but such are the strange ways of IE and they want me to patch the servlet to send appropriate mime-type.

Now, I am left with patching the servlet (which is outside the scope) and moreover i dont have access to. Bummer, grumble grumble grumble!!!!

Leave a comment