HTTP请求标头X-Requested-With来自何处 [英] Where does the HTTP Request Header X-Requested-With come from

查看:156
本文介绍了HTTP请求标头X-Requested-With来自何处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道我们可以使用 X-Requested-With http请求标头判断http请求是否来自Ajax。

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.

许多javascript框架会在其ajax请求中自动添加 X-Requested-With 标头,例如jQuery Ajax 原型Ajax 。作为 HTTP标题字段列表的维基说明 X-请求非标准请求标题

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.

google多次后,我还没找到谁首先想出 X-Requested-With 请求标题。

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

所以我想知道是否还有其他人知道 X-Requested-With 来自哪里?谢谢...

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

推荐答案

对Prototype的引用支持 X-Requested-With 可以在应该找到有一个标准的X-Ajax-Engine请求标题?(发布于2006年6月30日)。

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).

在Github上的jQuery源代码库中引用到2006年5月16日的 ajax.js 其中 X-Requested-With 最初添加。

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.

02/09/08 之前,Dojo没有看到添加此内容并引用其他库:

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


jQuery,Prototype,YUI和 - 看起来 - Mootools发送标题
X-Requested-With :XMLHttpRequest与他们的XHRs。

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

通过 2008-10-21 v1.4 ,MochiKit称之为标准:

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


MochiKit.Async现在设置X-Requested-With:XMLHttpRequest标题,
a事实上的标准(Prototype,jQuery,Mootools)。

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

这篇关于HTTP请求标头X-Requested-With来自何处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆