This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||
|
This article links to one or more target anchors that no longer exist.
Please help fix the broken anchors. You can remove this template after fixing the problems. |
Reporting errors |
For older discussion on this article dating from 2005-2008, please see Talk:XMLHttpRequest/2005-2008.
Can anyone provide a source for this statement: If the Content-Type request header was not added through setRequestHeader yet, it should automatically be added by a conforming user agent as "application/xml;charset=charset," where charset is the encoding used to encode the document.
It appears that it is not possible to set the charset of the Request Header. It is always set to UTF-8, regardless of the document encoding. —Preceding unsigned comment added by Nepherim ( talk • contribs) 18:32, 13 June 2010 (UTC)
Can anyone provide any reference to show that the IE cache bug descirbed in the 'known bugs' is correct? I have never encountered this problem. -- Sleepyhead 10:31, 20 August 2005 (UTC)
I remember having problems with opera caching get requests using this. I appeneded a unixtimestamp to avoid it though.
I experienced a problem where IE would cache the previous XML response while Firefox would always refresh. In the end simply getting the servlet that returned the XML to add the HTTP header 'Expires: -1' seemed to fix the problem - it now works fine with both browsers. -- Stuartallen1972 00:53, 31 October 2007 (UTC)
The article correctly states IE had XHR in versions prior to 7. However, I notice someone has been removing the fact that versions before 7.0 cannot instantiate the now-standard XMLHttpRequest class without workarounds, because the original Microsoft XMLHTTP was not a class of its own, but an ActiveXObject. None of the examples on the page work in IE 5.x-6.x without code somewhat like this, and the info on the page is misleading without it, so please discuss here before removing it again: 74.192.58.22 ( talk) 16:17, 27 August 2008 (UTC)
// Make the XMLHttpRequest class available in IE 5.x-6.x:
if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
throw new Error( "This browser does not support XMLHttpRequest." )
};
methods and properties have no reason to be in a wikipedia article. Resume it to help people discover what it can do ll be more intructive. as a developper find this chapter usefull but not for non programmer. perhaps specific code could be keep ? —Preceding unsigned comment added by 92.131.191.80 ( talk) 17:06, 3 September 2008 (UTC)
Wikipedia links to handy programmer references: it isn't one itself. -- Piet Delport ( talk) 14:33, 6 January 2011 (UTC)
I, too, came here looking for xmlhttp info. If there is code too, well, bravo! So much the better! It means I can save thirty minutes. So please: don't remove any code. — Preceding unsigned comment added by Pete142 ( talk • contribs) 10:44, 10 January 2011 (UTC)
This paragraph seems a bit out of place:
because XMLHttpRequest doesn't use XML-RPC either, and it's not mentioned anywhere else in the article or in the citation for that Microsoft API. Perhaps I'm missing something though, so leaving it for someone who knows more about this stuff than me. -- Qef ( talk) 12:08, 10 July 2009 (UTC)
First time I am reading the article and I notice that the "HTTP request" section has been tagged as having no reference. Looking through the history, the revision this has been done is "10:38, 1 October 2010 Mabdul". Although I can understand that two citations aren't much for that amount of text, a better thing to do would have been to look for references where you thought they would have been useful. I've been observing a tendency to flag things instead of contributing. If people have enough knowledge to flag, I'm expecting that they also have enough knowledge to correct things too. Otherwise, what I've learnt today on this article wouldn't have been available to me. There should be a middle ground between flagging and leaving, and contributing. — Preceding unsigned comment added by Amenel ( talk • contribs)
This section contains flawed example code. It would be better to correct the code.
Specifically:
1) the code example shows the send method called before the callback event is defined; and
2) the text following the code discusses the effect of calling the send method before the open method (reversing the first two lines)
It would surely be better to include good code and, if there are inconsistencies between browsers when such code executes, discuss those inconsistencies, rather than the problems that might be caused by poorly written code.
Showing bad coding examples and then discussing what's wrong with them may be appropriate for an article about good and bad coding practices, but it's not appropriate here.
-- DMcMPO11AAUK/ Talk/ Contribs 19:06, 15 April 2011 (UTC)
The article portrays XMLHttpRequest as supporting http and https and XML and plain text. That's the way XMLHttpRequest was originally, but since then, it has evolved to a more generic scriptable URL fetch mechanism.
These days, at least the development versions of all major browsers support URL schemes beyond http: and https:. In particular, blob: URLs are supported, see http://dev.w3.org/2006/webapi/FileAPI/ for spec.
Response types beyond XML and plain text are supported. These days, HTML, byte buffer and JSON responses are supported, too. See: https://developer.mozilla.org/En/HTML_in_XMLHttpRequest http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html https://bugzilla.mozilla.org/show_bug.cgi?id=707142 http://www.html5rocks.com/en/tutorials/file/xhr2/
I'm not making edits to the article myself, since my edits would probably get reverted as violating some Wikipedia policy against primary sources as I have implemented some of these features for Firefox/Gecko. Hsivonen ( talk) 11:32, 5 February 2012 (UTC)
Concerning editing and maintaining JavaScript-related articles...
If you are interested in collaborating on JavaScript articles or would like to see where you could help, stop by Wikipedia:WikiProject JavaScript and feel free to add your name to the participants list. Both editors and programmers are welcome.
We've found over 300 JavaScript-related articles so far. If you come across any others, please add them to that list.
Aren't this kind of stuff should be made by special page Category:JavaScript page? 82.142.169.244 ( talk) 14:00, 4 August 2017 (UTC)
The WikiProject is also taking on the organization of the Wikipedia community's user script support pages. If you are interested in helping to organize information on the user scripts (or are curious about what we are up to), let us know!
If you have need for a user script that does not yet exist, or you have a cool idea for a user script or gadget, you can post it at Wikipedia:User scripts/Requests. And if you are a JavaScript programmer, that's a great place to find tasks if you are bored.
If you come across a JavaScript article desperately in need of editor attention, and it's beyond your ability to handle, you can add it to our list of JavaScript-related articles that need attention.
At the top of the talk page of most every JavaScript-related article is a WikiProject JavaScript template where you can record the quality class and importance of the article. Doing so will help the community track the stage of completion and watch the highest priority articles more closely.
Thank you. The Transhumanist 01:15, 12 April 2017 (UTC)
if (window.XMLHttpRequest) ? Really? This is 2020, all major browsers support this feature without polyfills, and very few APIs bother checking. — Preceding unsigned comment added by 172.56.42.63 ( talk) 02:18, 27 December 2020 (UTC)
"Particularly, retrieval of data from XHR for the purpose of continually modifying a loaded web page is the underlying concept of Ajax design."
This really isn't open to dispute. First line of the latest standard: " The XMLHttpRequest object is an API". The object implements an interface. One programs applications using that object that implements that interface. The standard specifies the required behavior of the interface, which in browser JavaScript runtimes is bound to objects created by calls to a constructor. citation needed There is no requirement that the objects are instances of a class in JavaScript or any other language. citation needed 2601:642:4600:D3B0:9111:FF68:B849:3D9B ( talk) 21:00, 8 April 2024 (UTC)
I will add that the description of the methods appears to be written by someone who has never programmed an HTTP request in their life. "The HTTP request method may be GET for typical quantities of data." Nonsense. One does not choose between GET and POST based on the quantity of information sent, but why it is sent: to retrieve a resource, or to create/alter one. "If the request method of POST is invoked, then the web server expects the form data to be read from the standard input stream." That has nothing to do with XMLHttpRequest, and furthermore it isn't true. The data sent in a POST request isn't necessarily "form data", and the server can take it in any manner whatsoever. Taking it on standard input is a particular convention of CGI, a nearly obsolete technology. 2601:642:4600:D3B0:9111:FF68:B849:3D9B ( talk) 22:57, 8 April 2024 (UTC)
I will add that the description of the methods appears to be written by someone who has never programmed an HTTP request in their life.: Please refrain from personal attacks. Timhowardriley ( talk) 07:27, 9 April 2024 (UTC)
Nonsense: If you want to drill down on anything specific, then address it in a talk section. Be prepared to support your assertions with reliable sources. Timhowardriley ( talk) 07:27, 9 April 2024 (UTC)
request.open( "DELETE", null );
2601:642:4600:D3B0:9111:FF68:B849:3D9B (
talk) 14:13, 9 April 2024 (UTC)
request.open( "DELETE", null );: Please provide some context. Timhowardriley ( talk) 14:44, 9 April 2024 (UTC)
I will not refrain from criticizing the inclusion of wanton misinformation in the article.: Please keep the discussion cordial. Timhowardriley ( talk) 14:44, 9 April 2024 (UTC)
For a deeper discussion see Roy Fielding's dissertation on REST.: If material in this dissertation is germane to the discussion, then quote from it to support an assertion. Timhowardriley ( talk) 14:44, 9 April 2024 (UTC)
This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||
|
This article links to one or more target anchors that no longer exist.
Please help fix the broken anchors. You can remove this template after fixing the problems. |
Reporting errors |
For older discussion on this article dating from 2005-2008, please see Talk:XMLHttpRequest/2005-2008.
Can anyone provide a source for this statement: If the Content-Type request header was not added through setRequestHeader yet, it should automatically be added by a conforming user agent as "application/xml;charset=charset," where charset is the encoding used to encode the document.
It appears that it is not possible to set the charset of the Request Header. It is always set to UTF-8, regardless of the document encoding. —Preceding unsigned comment added by Nepherim ( talk • contribs) 18:32, 13 June 2010 (UTC)
Can anyone provide any reference to show that the IE cache bug descirbed in the 'known bugs' is correct? I have never encountered this problem. -- Sleepyhead 10:31, 20 August 2005 (UTC)
I remember having problems with opera caching get requests using this. I appeneded a unixtimestamp to avoid it though.
I experienced a problem where IE would cache the previous XML response while Firefox would always refresh. In the end simply getting the servlet that returned the XML to add the HTTP header 'Expires: -1' seemed to fix the problem - it now works fine with both browsers. -- Stuartallen1972 00:53, 31 October 2007 (UTC)
The article correctly states IE had XHR in versions prior to 7. However, I notice someone has been removing the fact that versions before 7.0 cannot instantiate the now-standard XMLHttpRequest class without workarounds, because the original Microsoft XMLHTTP was not a class of its own, but an ActiveXObject. None of the examples on the page work in IE 5.x-6.x without code somewhat like this, and the info on the page is misleading without it, so please discuss here before removing it again: 74.192.58.22 ( talk) 16:17, 27 August 2008 (UTC)
// Make the XMLHttpRequest class available in IE 5.x-6.x:
if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
throw new Error( "This browser does not support XMLHttpRequest." )
};
methods and properties have no reason to be in a wikipedia article. Resume it to help people discover what it can do ll be more intructive. as a developper find this chapter usefull but not for non programmer. perhaps specific code could be keep ? —Preceding unsigned comment added by 92.131.191.80 ( talk) 17:06, 3 September 2008 (UTC)
Wikipedia links to handy programmer references: it isn't one itself. -- Piet Delport ( talk) 14:33, 6 January 2011 (UTC)
I, too, came here looking for xmlhttp info. If there is code too, well, bravo! So much the better! It means I can save thirty minutes. So please: don't remove any code. — Preceding unsigned comment added by Pete142 ( talk • contribs) 10:44, 10 January 2011 (UTC)
This paragraph seems a bit out of place:
because XMLHttpRequest doesn't use XML-RPC either, and it's not mentioned anywhere else in the article or in the citation for that Microsoft API. Perhaps I'm missing something though, so leaving it for someone who knows more about this stuff than me. -- Qef ( talk) 12:08, 10 July 2009 (UTC)
First time I am reading the article and I notice that the "HTTP request" section has been tagged as having no reference. Looking through the history, the revision this has been done is "10:38, 1 October 2010 Mabdul". Although I can understand that two citations aren't much for that amount of text, a better thing to do would have been to look for references where you thought they would have been useful. I've been observing a tendency to flag things instead of contributing. If people have enough knowledge to flag, I'm expecting that they also have enough knowledge to correct things too. Otherwise, what I've learnt today on this article wouldn't have been available to me. There should be a middle ground between flagging and leaving, and contributing. — Preceding unsigned comment added by Amenel ( talk • contribs)
This section contains flawed example code. It would be better to correct the code.
Specifically:
1) the code example shows the send method called before the callback event is defined; and
2) the text following the code discusses the effect of calling the send method before the open method (reversing the first two lines)
It would surely be better to include good code and, if there are inconsistencies between browsers when such code executes, discuss those inconsistencies, rather than the problems that might be caused by poorly written code.
Showing bad coding examples and then discussing what's wrong with them may be appropriate for an article about good and bad coding practices, but it's not appropriate here.
-- DMcMPO11AAUK/ Talk/ Contribs 19:06, 15 April 2011 (UTC)
The article portrays XMLHttpRequest as supporting http and https and XML and plain text. That's the way XMLHttpRequest was originally, but since then, it has evolved to a more generic scriptable URL fetch mechanism.
These days, at least the development versions of all major browsers support URL schemes beyond http: and https:. In particular, blob: URLs are supported, see http://dev.w3.org/2006/webapi/FileAPI/ for spec.
Response types beyond XML and plain text are supported. These days, HTML, byte buffer and JSON responses are supported, too. See: https://developer.mozilla.org/En/HTML_in_XMLHttpRequest http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html https://bugzilla.mozilla.org/show_bug.cgi?id=707142 http://www.html5rocks.com/en/tutorials/file/xhr2/
I'm not making edits to the article myself, since my edits would probably get reverted as violating some Wikipedia policy against primary sources as I have implemented some of these features for Firefox/Gecko. Hsivonen ( talk) 11:32, 5 February 2012 (UTC)
Concerning editing and maintaining JavaScript-related articles...
If you are interested in collaborating on JavaScript articles or would like to see where you could help, stop by Wikipedia:WikiProject JavaScript and feel free to add your name to the participants list. Both editors and programmers are welcome.
We've found over 300 JavaScript-related articles so far. If you come across any others, please add them to that list.
Aren't this kind of stuff should be made by special page Category:JavaScript page? 82.142.169.244 ( talk) 14:00, 4 August 2017 (UTC)
The WikiProject is also taking on the organization of the Wikipedia community's user script support pages. If you are interested in helping to organize information on the user scripts (or are curious about what we are up to), let us know!
If you have need for a user script that does not yet exist, or you have a cool idea for a user script or gadget, you can post it at Wikipedia:User scripts/Requests. And if you are a JavaScript programmer, that's a great place to find tasks if you are bored.
If you come across a JavaScript article desperately in need of editor attention, and it's beyond your ability to handle, you can add it to our list of JavaScript-related articles that need attention.
At the top of the talk page of most every JavaScript-related article is a WikiProject JavaScript template where you can record the quality class and importance of the article. Doing so will help the community track the stage of completion and watch the highest priority articles more closely.
Thank you. The Transhumanist 01:15, 12 April 2017 (UTC)
if (window.XMLHttpRequest) ? Really? This is 2020, all major browsers support this feature without polyfills, and very few APIs bother checking. — Preceding unsigned comment added by 172.56.42.63 ( talk) 02:18, 27 December 2020 (UTC)
"Particularly, retrieval of data from XHR for the purpose of continually modifying a loaded web page is the underlying concept of Ajax design."
This really isn't open to dispute. First line of the latest standard: " The XMLHttpRequest object is an API". The object implements an interface. One programs applications using that object that implements that interface. The standard specifies the required behavior of the interface, which in browser JavaScript runtimes is bound to objects created by calls to a constructor. citation needed There is no requirement that the objects are instances of a class in JavaScript or any other language. citation needed 2601:642:4600:D3B0:9111:FF68:B849:3D9B ( talk) 21:00, 8 April 2024 (UTC)
I will add that the description of the methods appears to be written by someone who has never programmed an HTTP request in their life. "The HTTP request method may be GET for typical quantities of data." Nonsense. One does not choose between GET and POST based on the quantity of information sent, but why it is sent: to retrieve a resource, or to create/alter one. "If the request method of POST is invoked, then the web server expects the form data to be read from the standard input stream." That has nothing to do with XMLHttpRequest, and furthermore it isn't true. The data sent in a POST request isn't necessarily "form data", and the server can take it in any manner whatsoever. Taking it on standard input is a particular convention of CGI, a nearly obsolete technology. 2601:642:4600:D3B0:9111:FF68:B849:3D9B ( talk) 22:57, 8 April 2024 (UTC)
I will add that the description of the methods appears to be written by someone who has never programmed an HTTP request in their life.: Please refrain from personal attacks. Timhowardriley ( talk) 07:27, 9 April 2024 (UTC)
Nonsense: If you want to drill down on anything specific, then address it in a talk section. Be prepared to support your assertions with reliable sources. Timhowardriley ( talk) 07:27, 9 April 2024 (UTC)
request.open( "DELETE", null );
2601:642:4600:D3B0:9111:FF68:B849:3D9B (
talk) 14:13, 9 April 2024 (UTC)
request.open( "DELETE", null );: Please provide some context. Timhowardriley ( talk) 14:44, 9 April 2024 (UTC)
I will not refrain from criticizing the inclusion of wanton misinformation in the article.: Please keep the discussion cordial. Timhowardriley ( talk) 14:44, 9 April 2024 (UTC)
For a deeper discussion see Roy Fielding's dissertation on REST.: If material in this dissertation is germane to the discussion, then quote from it to support an assertion. Timhowardriley ( talk) 14:44, 9 April 2024 (UTC)