Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 648
monjer Avatar asked Feb 13 '14 09:02

monjer


1 Answers

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

like image 147
Kevin Hakanson Avatar answered Sep 22 '22 14:09

Kevin Hakanson