Where does the HTTP Request Header X-Requested-With come from

落爺英雄遲暮 提交于 2019-12-05 18:53:29

问题


As we know we can use the X-Requested-With http request header to judge that if a http request comes from Ajax or not.

Many javascript framework will auto add X-Requested-With header in their ajax request,such as jQuery Ajax,Prototype Ajax.And as the wiki of List of HTTP header fields says the X-Requested-With is a non-standard request header.

After google many times , I haven't found who first come up with the X-Requested-With request header.

So I want to know if anybody else know where the X-Requested-With comes from ? Thanks...


回答1:


References to Prototype supporting X-Requested-With can be found in Should there be a standard X-Ajax-Engine request header? (posted on 6/30/2006).

Reference in the jQuery source code repository on Github to the May 16, 2006 version of ajax.js where X-Requested-With is originally added.

Dojo didn't see to add this until 02/09/08 and references the other libraries:

jQuery, Prototype, YUI and - as it seems - Mootools send the header "X-Requested-With: XMLHttpRequest" with their XHRs.

By 2008-10-21 v1.4, MochiKit calls this a standard:

MochiKit.Async now sets the "X-Requested-With: XMLHttpRequest" header, a de facto standard (Prototype, jQuery, Mootools).



来源:https://stackoverflow.com/questions/21749461/where-does-the-http-request-header-x-requested-with-come-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!