Talk:XMLHttpRequest/2005-2008

'The discussion on this page is archived. Please add new discussion to the main talk page: Talk:XMLHttpRequest'

Internet Explorer version
I've re-fixed this article to state that it was Internet Explorer 5.0 with the first support for XMLHttpRequest. While it's true that Internet Explorer 4.0 had support for an older version of MSXML, this older version of MSXML did not contain the XMLHttpRequest object. Please see the following link, where it is unambiguously stated that 5.0 was the first version with XMLHttpRequest support:

http://www.microsoft.com/mind/0999/webapp/webapp.asp

The supporting evidence for the 4.0 claim, as supplied by Sleepyhead81, doesn't mention XMLHttpRequest at all, merely MSXML:

http://support.microsoft.com/default.aspx?scid=kb;en-us;269238

Unless stronger evidence exists that 4.0 introduced this object, the article should continue to state that 5.0 was the first version with XMLHttpRequest support.

Update: further evidence that 5.0 is correct and 4.0 is incorrect. An Internet Explorer developer states this in his weblog:

http://blogs.msdn.com/dmassy/archive/2005/03/20/399412.aspx

setRequestHeader
Why is it stated that that IE does not support "setRequestHeader" ? It does support it, see a.o. http://support.microsoft.com/kb/893659.

req.open("POST", "xml.php"); try { // IE does not have this method req.setRequestHeader('Content-Type','text/xml'); } catch (error) {}; req.send('  test  ');

Taka 13:53, 29 October 2005 (UTC)


 * Fixed. --minghong 00:21, 15 November 2005 (UTC)

Adobe's Flash Player
Actually, Adobe does own the Flash Player, having recently acquired Macromedia. Please don't change this entry, no matter how funny you think it is. Scott Arbeitman 12:20, 16 December 2005 (UTC)


 * Yes, Adobe has acquired Macromedia. But the name Macromedia Flash Player is still used on the adobe.com website. Also Flash is known as Macromedia Flash - not Adobe Flash. So choosing the latter name is a bit confusing. I think it should state Macromedia Flash Player - at least until Adobe change the name. --Sleepyhead 12:47, 16 December 2005 (UTC)


 * OK, agreed. I will change it back. --Scott Arbeitman 06:36, 17 December 2005 (UTC)

Isn't XmlHttp ActiveX?
Under other ways of achieving XmlHttp-like functionality, ActiveX is listed. However, XmlHttpRequest is implemented as an ActiveX technology in Internet Explorer. I definitely see the point of listing it, but as stated it isn't entirely accurate. --Scott Arbeitman 06:41, 17 December 2005 (UTC)

Browser specific issues
Some websites that are generated with MS Visual Studio use IE-specific settings and can not be viewed with other browsers. If there are are information about this issues, I thing including them will help. For example there's a IBM Developerworks tutorial about how to migrate from IE to Mozilla.  If someone has more information, please let me know.

Examples of applications that use XMLHTTP
There used to be a similar section to this on our Ajax article, and it was deleted as it attracted depressing amounts of link spam, for sites that used Ajax in even a trivial capacity. I have scaled the list on this XMLHTTP page down to the big names (Google maps, Suggest etc.), but I think the section could just as well be deleted outright. Rufous 16:54, 8 January 2006 (UTC)


 * It must be deleted: virtually any website will be an example of HTML, Ajax, CSS etc... There is nothing to learn, this is a reason to use them, but Wikipedia is not a tribune... Alcalazar 11:40, 13 April 2006 (UTC)

most well designed webpages use XHLHTTP????
Give me a break - most well designed webpages DON"T NEED anything other than HTML and CSS... --81.59.104.31 Most well-designed web pages using XMLHTTP are designed to hide the minor differences in these XMLHTTP object implementations
 * Er, read that sentence again. Rufous 21:30, 17 January 2006 (UTC)

XMLHTTP in ASP?
This article concentrates on browsers, but XMLHTTP is available in ASP through Server.CreateObject("Microsoft.XMLHTTP"). I'm not sure if this is worth mentioning, and I am also not positive what the exact server requirements are to support it. Mpd 21:31, 20 April 2006 (UTC)

One solution to this is to use the POST request method, which is never cached; however, it is intended for non-idempotent operations.

Non-idempotence
Does anyone else feel that "non-idempotence" is irrelevant when the problem with GET is caching? If caching is causing problems, surely it could only be a non-idempotent operation that is being carried out?
 * Not necessarily. Suppose you GET weather forecasts for the next hour. Result "14:00-15:00 Sunny, slight cloud coverage. 5% precipitation chance.".
 * At 15:00 the server will change the message, to say "15:00-16:00 Sunny, some large clouds. 15% precipitation chance.". If the last message was cached locally, and didn't properly expire, then caching can cause a problem, even though it's idempotent.
 * Of course, in this case the server should send an expires header, but perhaps there are situations where client-side expiration is needed. Who knows. By the way, I'll remove the random-id thingy, as that would "snow" your cache, possibly making browsing a lot more harddisk intensive. Shinobu 03:41, 24 July 2006 (UTC)

Browsers, that do not yet have documentation from web-master perspective ?
Opera has offivial claim about support of XMLHTTPRequest, yet they do not offer the documentation (guess they are treating W3's draft as such? ) http://www.opera.com/docs/specs/opera9/index.dml - Desktops http://www.opera.com/pressreleases/en/2005/11/15/index.dml - mobile phones

KDE Konqueror shares much of code with Apple Safari and hence is supporting it too. KDE documents XMLHTTPRequest for C++ developers, but not for Web-masters (or i failed to find it). http://developer.kde.org/documentation/library/cvs-api/kdelibs-apidocs/khtml/html/xmlhttprequest_8h-source.html

Should those links be mentioned on the page in See Also section (guess not in Documentation, since they are not documentation for web-masters) ?

Opinions
"One of the best Javascript libs out there that enhances XMLHttpRequests is protoype.js"

Sounds like an opinion to me? I don't mean to say that prototype is not good (actually I have no idea), but Wikipedia is about facts not opinions.


 * Yes, there are now millions of "web 2.0" libs out there, Wikipedia shouldn't be passing judgements on which are the best. 209.92.136.131 15:04, 20 June 2006 (UTC)

Handling of plain text and utf-8
I find this part confusing: "If the server answer does not encapsulate the result in an XML format, the 'responseText' may not work correctly when using non-ASCII characters, for example accented characters like é. Although Firefox copes with such data, Internet Explorer will only handle it properly for the first request (although there may be display problems). If the request is repeated and Internet Explorer uses a cached result, then it will generate a JavaScript error."

The formulation of this seems to come from somebody who has no idea about character encodings and HTTP headers. It also sounds like this is personal research. I would like to see a pointer to an external article that substantiates the issue above. I have tried to Google this and so far I have not found an article or blog entry reporting issues for example with JSON and IE when using utf-8. Of course if you don't send your text with something like: "Content-Type: text/plain; encoding=utf-8", nothing will work.
 * What I think the writer is trying to say is this: When you first open a textfile on a webserver, the request converts from the supplied encoding to UCS-2 (or UTF-16, but I don't know if it supports surrogates). But if the request gets the textfile from the cache, it converts from ANSI.
 * Whether it really does this, I don't know. Are character encodings saved with the textfiles in the cache? I don't know. I wonder if there's a way to find this out... Shinobu 11:05, 4 August 2006 (UTC)

I did find a reference to such an issue ... http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=1836 ... see the stuff by Mike Sullivan? If true, however, this only affects IE 5.5 and earlier - all later versions shipped with newer MSXML. - MJB, Sept 23 2006

Reusing XMLHttpRequest In Netscape 8.1
I find that if I reuse the request object in Netscape 8.1, the second request arrives at the server, but the response does not get back to the client. The readyState property stays at 1 ("loading"). This happens even if I call abort in state 4 of the first request. If I always create a new XMLHttpRequest object, all works fine. So, how come all the Web references to this reusability problem just discuss the IE requirement of doing the open and onreadystatechange operations in that order, and none mention a problem with Netscape? David 19:35, 8 September 2006 (UTC)

Synchronous calls in Mozilla
I have removed the section about the onreadystate event not working with synchronous calls in Mozilla. Mainly, using the event in synchronous mode is utterly pointless, since the whole purpose of synchronous calling is to block the code and hence it does not require an event handler. Also, the example code was messy and would not have worked.

I didn't notice at the time, but my edit is credited to 121.44.46.109 as I forgot to log in.

- Penagate 09:20, 29 September 2006 (UTC)

Thank you for the information about IE caching!
I have been struggling with that and unable to find the right combination of parameters to avoid the caching. The clear explanation here of what to add to the xhr request is wonderful, and it works!

--Julian

How is XHR pronounced?
Maybe if someone knows the answer they can add it to the topic? I am searching for that knowledge. Thanks. --TrentonLipscomb 09:06, 19 December 2006 (UTC)

'XML HTTP Request' is the only way I refer to it. - Penagate 15:12, 3 January 2007 (UTC)
 * I can't help but laugh at this one, sorry. :-)

XHR is pronounced like "Eggs Age Are" or "exachar", depending upon caffeine intake. Not sure how to spell it, though. :) --Anoop 74.192.49.12 (talk) 22:26, 25 November 2007 (UTC)

About SetRequestHeader
I have found this example in the article:


 * req.open( "GET", "xmlprovider.php" );
 * req.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" ); //This :line doesn't work.
 * req.send( null );

Does it work or not? —The preceding unsigned comment was added by Booles (talk • contribs) 13:29, 19 February 2007 (UTC).

Opening paragraph
The opening paragraph is currently

XMLHttpRequest (XHR) is an API that can be used by JavaScript, and other web browser scripting languages to transfer XML and other text data to and from a web server using HTTP, by establishing an independent communication channel between a web page's Client-Side and Server-Side.

Should "by" be changed to "thereby" (as in, "...thereby establishing an independent communication channel"? 89.241.169.237 23:02, 31 May 2007 (UTC)


 * No, I don't think so. The way it transfers data is by establishing an independent communication channel.  Looks fine to me as it is.  --Doradus 13:11, 30 June 2007 (UTC)

BIG edit with no summary
Is this edit ok with everyone? It's awfully big to have no edit summary. --Doradus 13:10, 30 June 2007 (UTC)

Rename to XMLHttpRequest
I suggest that this article is renamed to XMLHttpRequest which is the correct and complete term for the object used in the browsers. --Sleepyhead 12:22, 22 August 2005 (UTC)


 * Doesn't Mozilla use XMLHttpRequest? See Mozilla xmlextras, for example. Hmmm, actually that seems to be the preferred style:     Mindmatrix 13:18, 22 August 2005 (UTC)


 * Correct. I have updated my comment. I think XMLHTTP (Microsoft object) should be moved to XMLHttpRequest (opera/safari/mozilla/general style). XMLHTTPRequest should be redirected to XMLHttpRequest. --Sleepyhead 13:39, 22 August 2005 (UTC)


 * What happened to this discussion? I think there is no doubt now that this article should be 'moved' to XMLHttpRequest, (now a W3C Working Draft (05 April 2006)).  The article should still mention the historical fact that MS originally implemented the API as an Active-X server called XMLHTTP in their MSXML dll, but once IE7 hits the streets, that will become more of a historical footnote.  --Nigelj 19:03, 11 April 2006 (UTC)
 * I tried to move the page today, but it errored because the redirect at XMLHttpRequest has some history. I could have tried to do a three-way thing ending up with a page called XMLHttpRequest (Please delete me), but the error page told me to put a request on WP:RM and an Admin would sort it out.  So that's what I've done. --Nigelj 10:31, 29 April 2006 (UTC)
 * Done. &mdash; Nightst a  llion  (?) Seen this already? 07:48, 4 May 2006 (UTC)
 * Does anybody know why its name is so crappy? I mean it's a broken camelcase. If I were a browser programmer, I would either call it XMLHTTPRequest or XmlHttpRequest (not XMLHttpRequest as it is). Do you know any articles discussing this matter? 83.9.9.143 00:38, 21 August 2007 (UTC)

Is the Known Problems section encyclopedic?
I have a feeling this would fit better someplace akin w3schools instead of an encyclopedia. --Qviri (talk) 17:16, 27 January 2006 (UTC)


 * It is very Wikipedia-encyclopedic. We have the finest collection of computer-related information articles to be found anywhere.
 * Now: I think we need to add something about MIME type problems. These creep up quite a bit, especially when working with Safari. Thoughts? 70.20.179.75 21:39, 29 January 2006 (UTC)


 * I don't mind information, and I love webdev personally, but this is a FAQ section, for crying out loud. --Qviri (talk) 00:39, 30 January 2006 (UTC)


 * If the Known Problems section is maintained, it might be good to also mention Mozilla's (and other's?) need for script signing when the script accesses external sites. -- Peter 10:44, 2 March 2006 (UTC)

Encyclopedia articles should be written for the general reader, and be descriptive, not instructional. But then, who is the "general reader" in a given context, and when does describing an issue become instruction?

In this case it does seem the line has been crossed though, by not only describing programming issues, but giving specific recommendations on how to fix them. Can you imagine an article on elephants in Africa that goes on to list specific steps that nature reserve managers should take to deal with an outbreak of some communicable animal disease? The existence of the disease, that steps are being implemented to deal with it, are descriptive. Specific instructions on how to apply a solution of iodine two times daily to the affected patches on the elephants' skin -- and you may find the elephants more cooperative after hay feeding time -- goes in a newsletter to the nature reserve managers, not an encyclopedia.

Nonetheless, this is great, useful informations (for the minority of readers actually using the technology rather than wondering what the acronym means).

Does Wikimedia yet have a "manuals" section? That's where it belongs. The encyclopedia article describes that there are a number of issues that affect implementation, and refers the reader to the "manuals" article.

If presently we lack this "manuals" section, a good approach would be to create two articles on this subject: a descriptive overview, written for someone generally familiar with Web development, who has no intention of actually writing the code, and a "technical details" article for programmers.

XMLHTTP (Overview)

XMLHTTP (Technical Details)

Cross-referenced, of course.

document.implementation.createDocument
Shouldn't the article mention this other way of bringing in data to the browser? Wikipedia doesn't seem to have any articles that mention document.implementation. 209.92.136.131 15:04, 20 June 2006 (UTC)

Methods & properties
Wikipedia is not a programming reference guide, so we need to replace the terse tables of methods and properties with prose descriptions of what the interface does. --Doradus 12:27, 1 October 2006 (UTC)


 * So would code examples be out of the question? Or are code examples better suited to external links? DRogers 12:56, 4 October 2006 (UTC)


 * Good question... I’m not sure anymore.  Maybe I should say we should have prose descriptions before we dive into the API and examples?  --Doradus 17:59, 6 October 2006 (UTC)

Tutorials out of date
The tutorial mentioned on the page are out of date. They need to be either replaced by up to date versions or deleted. I'll look around and report back later. —The preceding unsigned comment was added by 80.99.57.174 (talk) 15:19, 15 May 2007 (UTC).

Cross-site XMLHttp
Perhaps this page could comment on the security restrictions often placed around XMLHttpRequest. I believe browsers usually restrict requests to the same domain as the page, is that correct? Firefox 3 plans to change that (according to its Wikipedia article). Would love someone with more knowledge than I to fill in some of that info. &mdash; SimonEast 07:54, 1 November 2007 (UTC)


 * Yes, I would also like to see some discussion about this. The article is correct by stating that IE7 now supports the native XMLHttpRequest, but it should also be recognized that files being run locally can access different domains only with the ActiveX method. In reply to SimonEast's comment, I believe it's actually the other way around &mdash; Access is restricted only to different domains, but allowed on same domains. It would also be nice to have some kind of documentation on enabling "UniversalBrowserRead". Daleyjem 16:15, 3 December 2007 (UTC)


 * You guys are saying the same thing - access is restricted if you attempt to access different domains, i.e. you cannot access different domains, i.e. you are restricted to accessing only the same domain. :)
 * If I recall correctly, the change in Firefox uses some different method, not XMLHttpRequest. —AySz88\ ^ - ^ 20:57, 5 April 2008 (UTC)

responseXML
Should be noticed: responseXML returns xml tree only if server mime type is "text/xml" or such, otherwise it will return NULL and responseText will contain whole plain text xml. —Preceding unsigned comment added by 93.80.199.160 (talk) 20:42, 13 August 2008 (UTC)

History of Microsoft's XMLHttpRequest object
A noteworthy article on this subject is that of Alex Hopmann ( http://www.alexhopmann.com/xmlhttp.htm ) who has been involved in the creation of XHR when working for Microsoft. What is especially interesting is the fact that XML wasn't a main factor in the technology, but was used as an excuse to get it to ship with the MSXML library and was added to the name to make for good marketing in a time where XML was 'hot'. —Preceding unsigned comment added by Therealcrisp (talk • contribs) 21:44, 17 August 2008 (UTC)