Possible Duplicate:
Accessing HTTP Headers in Javascript?
The only way what i know to read with javascript the current headers is:
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var headers = req.getAllResponseHeaders().toLowerCase();
But i don't want make a new request, i want read the current headers.
Is this posible? Thanks!
Yes. So, multiple headers with the same name is ok (www-authenticate is such a case) if the entire field-value is defined as a comma-separated list of values.
Reading Request Headers from Servlets Reading headers is very straightforward; just call the getHeader method of the HttpServletRequest , which returns a String if the header was supplied on this request, null otherwise.
While you can't ready any headers of HTML response in JS, you can read Server-Timing header, and you can pass arbitrary key-value data through it.
To see a list of HTTP request headers, you can use : console. log(JSON. stringify(req.
It's not possible to access page headers via Javascript, without sending ajax request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With