Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it called XMLHttpRequest?

I always wonder why this object is called like that?

The body of your request does not need to be in XML format. Also, data received from server can be fetched as JSON, XML, HTML, or plain text. XML does not play an essential part in this object. Is this some kind of a cliché? What is this object used to be when it was first created?

like image 518
KiL Avatar asked Aug 22 '12 06:08

KiL


People also ask

What is meant by XMLHttpRequest?

XMLHttpRequest (XHR) is a JavaScript API to create AJAX requests. Its methods provide the ability to send network requests between the browser and a server.

Is AJAX just another name for XMLHttpRequest?

XMLHttpRequest is just a implementation of ajax, The XMLHttpRequest object is used to exchange data with a server. Bare in mind, it is based on REST verbs, Get,Post etc, therefore it can upload and send multipart data, files with ftp you name it.

Who created XMLHttpRequest?

3 Answers. Show activity on this post. XMLHttpRequest was invented by Microsoft's Outlook Web Access team. This highly innovative team previously gave us remote scripting, which was the the beginning of "AJAX" style development.

What is difference between AJAX and XMLHttpRequest?

Ajax allows us to send and receive data from the webserver asynchronously without interfering with the current state or behavior of the web page or application. XHR is the XMLHttpRequest Object which interacts with the server.


2 Answers

XMLHttpRequest was invented by Microsoft's Outlook Web Access team. This highly innovative team previously gave us remote scripting, which was the the beginning of "AJAX" style development. Remote scripting was like JSONP, but overly complicated (it used a Java applet, of all things). I don't remember whether it was possible to dynamically inject <script> elements in IE 4 or 5, but it seems like that wasn't possible. Otherwise, JSONP seems powerful enough to eliminate the need for XMLHttpRequest.

The Outlook team was transferring XML from server to client, so the ActiveX control was named to reflect its primary use at the time. It was included as part of the MSXML parser.

By the time Firefox got in on the game and implemented their own version, XMLHttpRequest was being used more like it is today, and less for XML, but Firefox used the same name anyway. With the two biggest browser makers creating an object with the same name, interface, and functionality, the w3c stuck with the existing name. It's too bad someone didn't make more of a stink about the misnomer and insist we call it something more accurate like just HttpRequest.

I don't know how or why "AJAX" became the popular term to describe the programming style where a web page interacts with the server without requiring a complete page load. "AJAX" is a worse misnomer than "XMLHttpRequest" since it not only implies XML is an essential aspect, but further provides no indication of server interaction. I can process XML with JavaScript asynchronously without ever communicating with a server.

like image 85
gilly3 Avatar answered Sep 25 '22 19:09

gilly3


Short

Yes, the XML part in the name is all wrong.

Long

The best explanation comes from the MS engineer who invented XHR:

This was the good-old-days when critical features were crammed in just days before a release…I realized that the MSXML library shipped with IE and I had some good contacts over in the XML team who would probably help out—I got in touch with Jean Paoli who was running that team at the time and we pretty quickly struck a deal to ship the thing as part of the MSXML library. Which is the real explanation of where the name XMLHTTP comes from—the thing is mostly about HTTP and doesn’t have any specific tie to XML other than that was the easiest excuse for shipping it so I needed to cram XML into the name.

-- Alex Hopmann The story of XMLHTTP

This clearly states that seeking affiliations with XML, no matter how reasonable they are, is basically overinterpretation of authors' intentions.
Sorry to spoil the fun.

like image 20
vucalur Avatar answered Sep 23 '22 19:09

vucalur