Randy said:
Peter Michaux said the following on 1/18/2007 4:16 PM:
Post them with the UA, OS and any troubles and I can add it to my page,
then when I have time I can write a Notes article for review to post on
the jibbering server.
Below is a set of notes I gathered about 14! potential XHR hiccups for
beginners. Before posting this information on the jibbering site I
would make the effort to double check all the browser versions and
other details. I could also add a test case that shows the error and a
workaround for each.
If anyone knows another XHR bug please post it and I can look into it
also for inclusion.
Peter
-------------
Internet Explorer < 7
Must use ActiveXObject() constructor function to create an
XMLHttpRequest object. And must try different ways
new ActiveXObject("Msxml2.XMLHTTP.3.0");
new ActiveXObject("Msxml2.XMLHTTP");
new ActiveXObject("Microsoft.XMLHTTP");
Internet Explorer 6
Windows XP SP2
When the server response stored in xhr.responseText is very big
Internet Explorer noticably leaks memory. The solution is after the
code is finished with xhr either set xhr.onreadystatechange to an empty
function with a clean closure or to set xhr to null.
<URL:
http://groups.google.com/group/comp.lang.javascript/msg/556048483801bd96>
Netscape Navigator 6.1
Windows XP SP2
This is the first Netscape browser with the XMLHttpRequest()
constructor function. However it returns an object that is non
functional.
Netscape Navigator 6.2, 6.2.3
Windows XP SP2
The XMLHttpRequest objects are capable of GET and POST requests but the
xhr.send() function cannot be sent any argument other than null. If you
attempt to send a body as the argument to send the browser throws an
error.
Netscape Navigator 7.0 & 7.1
Windows XP SP2
When the server response stored in xhr.responseText is very big these
two versions of Navigator noticably leak memory. The known fixes for
the Internet Explorer memory leaks do not stop these problems.
Netscape Navigator 7.0
Windows XP SP2
If you want to set the "Accept" header of your XMLHttpRequest object
before sending the request to the server you are not getting a blank
canvas. When the XMLHttpRequest object is created it already has a
value for the Accept header. If you call
xhr.setRequestHeader("Accept", "text/javascript");
then this will not overwrite the original Accept header. Instead the
original header will have a comma and space appended followed byt the
new header.
Netscape Navigator <=7.1 && Firefox <=1.5
Windows XP SP2
Cannot make POST requests to URLs starting with localhost or to local
IP addresses. To test in these browsers the site must be live somewhere
out there on the web.
Firefox 1.5
When abort() is called a readystate 4 event is fired which is a
disaster. The "aborted" flag is a workaround to avoid having callbacks
fired when a request is aborted.
The Quirksmode website says that IE has this same bug and given the
date of writing it likely refers to IE 6.
http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_a_1.html
Opera 8.0
Opera 8 XMLHttpRequest objects don't have the setRequestHeader()
function and although the browser seems to be able to make a POST
request with a body without this function (and so without the usual
Content-Type = "application/x-www-form-urlencoded"). Note Opera 8.0.1
does have setRequestHeader() and can POST
Opera 8.51-8.53
Windows XP SP2
If the server response Content-Type header is "text/plain" or
"text/html" then all seems well. If it is "text/javascript" then the
xhr.responseText is garbled. It looks like a bunch of little squares
when printed. To feature test requires a test request sent to the
server and the response analysed. Probably not what you want to do
except in the most critical app on earth.
Opera 8.01, 9.10
Windows XP SP2
If the server sends a large response Opera's CPU useage rails at 100%
for a long time. Theses browsers are *very* slow to accept the
response.
iCab 3.0.3
Mac OS X 10.4.8
xhr.getResponseHeader() always returns an empty string however
xhr.getAllResponseHeaders() works. Here is a possible work around to
check if the Content-Type header is text/javascript or
application/javascript.
xhr.getResponseHeader("Content-Type").match(/(text|application)\/javascript/)
||
xhr.getAllResponseHeaders().match(/Content-Type\:\s(text|application)\/javascript/);
General Hearsay
Rumor has it that at least one browser caches GET requests made with an
XMLHttpRequest object. To avoid using any cached response add a unique
dummy id parameter as a query string to the URL to make it different
than all previous URLs and hence insure the specific new request has
never been cached.
Rumor has it that sometimes Firefox/Mozilla will throw an error when
accessing xhr.status and the Yahoo! UI library was the place I saw this.