問題描述
我一直想知道為什么這個對象被這樣稱呼?
I always wonder why this object is called like that?
您的請求正文不需要是 XML 格式.此外,從服務器接收的數據可以以 JSON、XML、HTML 或純文本的形式獲取.XML 在這個對象中并不重要.這是某種陳詞濫調嗎?這個對象最初創建時是什么?
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?
推薦答案
XMLHttpRequest
是由 Microsoft 的 Outlook Web Access 團隊發明的.這個高度創新的團隊之前給了我們遠程腳本,這是AJAX"風格開發的開始.遠程腳本類似于 JSONP,但過于復雜(它使用 Java 小程序,最重要的是).我不記得是否可以在 IE 4 或 5 中動態注入 <script>
元素,但這似乎是不可能的.否則,JSONP 似乎足夠強大,可以消除對 XMLHttpRequest
的需求.
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
.
Outlook 團隊正在將 XML 從服務器傳輸到客戶端,因此命名 ActiveX 控件以反映其當時的主要用途.它被包含在 MSXML 解析器中.
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.
當 Firefox 進入游戲并實現他們自己的版本時,XMLHttpRequest
的使用更像今天,而用于 XML 的則更少,但 Firefox 還是使用了相同的名稱.由于兩家最大的瀏覽器制造商創建了一個具有相同名稱、界面和功能的對象,w3c 堅持使用現有名稱.太糟糕了,有人沒有對這個誤稱更惡毒,并堅持我們稱它為更準確的東西,比如 HttpRequest
.
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
.
我不知道AJAX"是如何或為什么成為一個流行的術語來描述網頁與服務器交互而不需要完整的頁面加載的編程風格.與XMLHttpRequest"相比,AJAX"用詞不當,因為它不僅暗示 XML 是一個重要方面,而且還沒有提供服務器交互的指示.我可以使用 JavaScript 異步處理 XML,而無需與服務器通信.
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.
這篇關于為什么叫 XMLHttpRequest?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!