IE7 and XMLHttpRequest

I’ve spent a big part of the last week of my time lost in the abyss of IE 7 and XMLHttpRequest as part of MDL-28295 – it seems that under certain conditions a call to XMLHttpRequest crashes IE 7 when called from a child window….

Posting here in case someone else runs into this weird bug in the hope that it might save someone some time!
Pseudo code:
httpReq = new XMLHttpRequest();“POST”, url,false);
httpReq.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);

When “param” contains something like this it works fine!

but when “param” contains something like this – it crashes IE 7:

Initially I thought the encoding might be the issue and encoding the params using encodeURI() seemed to work – but further testing found it was still an issue.

The fix was to re-structure the code so that it didn’t call the code from a child window but from within the “parent” window…. crazy….

Tags: ,

Comments are closed.