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?


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.


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???


Yes, also make sure the file is output with the correct Content-Disposition using headers, do that IE gets "response.xml" and not "response.php" or some such...

'Content-Disposition: attachment; filename="response.xml"'

链接地址: http://www.djcxy.com/p/10442.html

上一篇: Windows字体呈现@font的问题

下一篇: Internet Explorer拦截XML响应