user635568
user635568

Reputation: 316

jquery or javascript classic to add http header infomation in the browser (permanent value)

I was wondering if it is possible to add http header information on a browser using jquery or a classic javascript in such a way that this added info will always available during http request like the "user-agent" sent in the server?

sorry on my wild imagination... ;)

Best regards, - toni

Upvotes: 2

Views: 5905

Answers (1)

mhoareau
mhoareau

Reputation: 751

Since jQuery 1.5, there is a 'headers' option in the jQuery.ajax() method :

Try it this way :

$.ajax({
    headers: {
        'X-My-Custom-Header':'value';
    },
    // ... Your other parameters in order
    // to define your request (url, method, etc.) ...
});

Upvotes: 3

Related Questions