Side navigation
#7047 closed bug (worksforme)
Opened September 17, 2010 06:21PM UTC
Closed September 18, 2010 02:23AM UTC
Last modified March 15, 2012 01:37PM UTC
ie7/8 ajax bug with html content type
Reported by: | doccoder | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.3 | |
Component: | ajax | Version: | 1.4.2 |
Keywords: | ajax,html,ie7,ie8 | Cc: | |
Blocked by: | Blocking: |
Description
Provided by Tim Nichols:
This happens on both IE7 and IE8 - if you make an ajax call and use html as your content type, the call fails. (text, json, and others work fine). It does not happen on IE6 or FF.
Work arounds:
Option 1- return text instead of html, then use:
success: function(data) {
xhr = (new DOMParser()).parseFromString(data, ‘text/html’);
…
}
Option 2- overload the jQuery.ajaxSetup() function.
// IE 7/8 fix for html ajax calls...
jQuery.ajaxSetup({ xhr:function() {
try {
if (window.ActiveXObject)
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {}
return new window.XMLHttpRequest();
}
});
Attachments (0)
Change History (1)
Changed September 18, 2010 02:23AM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
There's no test case, but in general the HTML data type works. If DOMParser works and injection via innerHTML (in $.ajax) does not, then most likely IE doesn't like the HTML because it has validity problems.