Skip to main content

Bug Tracker

Side navigation

#6123 closed bug (duplicate)

Opened February 19, 2010 04:45AM UTC

Closed September 02, 2010 04:39PM UTC

IE ajax methods don't return XMLHttpRequest in v1.4.x

Reported by: chris.raethke Owned by:
Priority: Milestone: 1.4.2
Component: ajax Version: 1.4
Keywords: Cc:
Blocked by: Blocking:
Description

From v1.4.0 onwards, any calls to $.ajax(), $.get(), $.getJSON() and $.post() return null instead of an XMLHttpRequest under Internet Explorer 7.

Attachments (1)
  • ajax_test_ie.html (1.1 KB) - added by chris.raethke February 19, 2010 04:46AM UTC.

    example of failure under ie

Change History (2)

Changed August 13, 2010 03:17PM UTC by copleykj comment:1

This issue seems to be that IE doesn't properly implement the XMLHttpRequest object. Upon testing if window.XMLHttpRequest exists it is reported as true but upon trying to create a new instance it reports that it doesn't. I have personally fixed this for myself with a simple modification.

This code starts on line 4952 in the development version if you want to modify so it's useable. If you do, I would recommend using something like http://refresh-sf.com/yui/ to compress it before you use it on your site

***** Original Code *****

xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ?

function() {

return new window.XMLHttpRequest();

} :

function() {

try {

return new window.ActiveXObject("Microsoft.XMLHTTP");

} catch(e) {}

},

***** New Function *****

xhr: window.ActiveXObject ?

function() {

try {

return new window.ActiveXObject("Microsoft.XMLHTTP");

} catch(e) {}

} :

function() {

return new window.XMLHttpRequest();

},

With the modification it checks to see if the browser implements the activex object xmlhttp instead and if available uses it first and XMLHttpRequest as a last resort. This may not be the best fix, BUT I need my sites to work in ALL major browsers as most people do.

Changed September 02, 2010 04:39PM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed

Dup of #6298.