Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the javascript default value of the async property on the XMLHttpRequest.open method?

I am finding different results between IE6 and Firefox 7. I am thinking the differences might not be so much with different browsers as much of IE6 is using an ActiveX control and everything else is using XMLHttpRequest. I believe XMLHttpRequest is not native until IE7.

Seems to be false in IE6 ActiveXObject and true Firefox 7. But I can't seem to find documention.

// one of these lines gets called - the first successful one
obj = new XMLHttpRequest();
obj = new ActiveXObject("Msxml2.XMLHTTP.3.0");
obj = new ActiveXObject("Msxml2.XMLHTTP");
obj = new ActiveXObject("Microsoft.XMLHTTP");
// now later the code makes this call
obj.open("GET",url);
// notice how the third parameter [async] is not assigned

My question is what is the default value of the async property in different scenarios described above?

like image 901
JeffJak Avatar asked Oct 16 '25 12:10

JeffJak


1 Answers

Defaults to true. See the docs.

Also, the way you are creating the XMLHttpRequest object is wrong. The obj variable will get overwritten for every statement. See this for a proper way to do it.

like image 168
pradeek Avatar answered Oct 19 '25 02:10

pradeek