Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internet explorer intercepts XML response

I have a form whose target is an iframe.

When submitting the form, the response is XML and I have Javascript that analyzes the response.

I noticed that when running on IE, IE intercepts the response and treats it as an RSS feed, so my code never receives the response. If I disable the RSS feeds (from the internet option, content tab) everything works ok.

I set the content type of the response to “text/xml; charset=UTF-8” but still it does not work.

Is there any workaround?

like image 559
Ronen Avatar asked Feb 14 '12 17:02

Ronen


2 Answers

The best workaround would be not to use an iframe in this case. It sounds like IE is catching the http response and reading it on its own. Is there a reason you're not making an AJAX call to retrieve the information? It sounds like you're relying on JavaScript to handle the response anyway, so I would think that using an XMLHttpRequest object would be better for you: http://www.w3.org/TR/XMLHttpRequest/

If that's too complicated, look into a library like jQuery: http://jquery.com/ that has built in (and much simpler) functions to make AJAX calls and handle responses.

To expand on this, you would bind the submit function of the form to a JS function (or use jQuery to do it) and pick up the form data, send it in an AJAX request, and handle the response. jQuery has a built in function serialize() which is meant to convert form data on a page into information ready for use in the ajax() function to send to the server. If you're unfamiliar with the XMLHttpRequest object, I would highly suggest using a library like jQuery for this task.

like image 150
Brian Avatar answered Oct 09 '22 02:10

Brian


OK, found the problem… My response XML contains FEEDBACK tags. IE treat these tags as RSS feeds. Changing the tag name to FDBACK resolve this issue…

MS, why this is not documented???

like image 36
Ronen Avatar answered Oct 09 '22 02:10

Ronen