Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the common HTTP header for request by JS libs?

Using the Prototype JavaScript framework I've noticed, that the Ajax requests are enriched with a header called X-Requested-With.

Do other JavaScript libraries like jQuery, dojo and YUI add headers to their Ajax requests? Is it always called X-Requested-With? Is this a standard?

The full header by Prototype:

X-Requested-With:     XMLHttpRequest
X-Prototype-Version:  1.5.0_rc0
like image 673
powtac Avatar asked Dec 21 '22 10:12

powtac


1 Answers

The X-Requested-With header is sent by default by the following frameworks:

  • Dojo
  • ExtJS
  • jQuery
  • MooTools
  • Node.js
  • Prototype
  • YUI

As usual, keep in mind that it is not mandatory for frameworks to send it, that sometimes the framework's user can override it, that client/firewall/proxy/server may affect it, and there are even known browser bug(s) for it.

like image 108
Sheepy Avatar answered Dec 24 '22 00:12

Sheepy