正如我们所知,我们可以使用X-Requested-With
http请求标头来判断http请求是否来自Ajax。
许多javascript框架会自动在他们的ajax请求中添加X-Requested-With
头,例如jQuery Ajax,Prototype Ajax.并且正如HTTP头字段列表的wiki所说,X-Requested-With
是一个非标准的请求头。
谷歌了很多次之后,我还没有找到谁先想出X-Requested-With
请求标头。
所以我想知道是否有其他人知道X-Requested-With
来自哪里?谢谢。。。
支持X-Requested-With
的原型参考可以在 应该有一个标准的 X-Ajax-Engine 请求标头吗?(发布于 2006 年 6 月 30 日)。
在 Github 上的 jQuery 源代码存储库中引用了 2006 年 5 月 16 日的 ajax 版本.js最初添加了 X-Requested-With
。
Dojo 直到 08 年 9 月 2 日才看到添加它并引用了其他库:
jQuery,Prototype,YUI和 - 看起来 - Mootools发送标头 "X-Request-With: XMLHttpRequest"及其 XHR。
到 2008-10-21 v1.4,MochiKit 称之为标准:
MochiKit.Async 现在设置了"X-Request-With: XMLHttpRequest"标头, 事实上的标准(Prototype,jQuery,Mootools)。