0

This is my Http header trace when i access pwd.html

host:port/pwd.html?type=Msg=8

POST /pwd.html?type=Msg=8 HTTP/1.1
Host: host:port
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: anotherhost:port/referrer
Cookie: SomeCookie=loggedoutcontinue; targetURL=Someurl
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 4936
  APP_REQ=324823823


HTTP/1.1 200 OK
Date: Tue, 26 Aug 2014 15:05:29 GMT
Server: Application-Server
Last-Modified: Mon, 25 Aug 2014 18:55:15 GMT
Accept-Ranges: bytes
Content-Length: 1336
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html
Content-Language: en

How can I read the value of APP_REQ from my pwd.html using Javascript? Its not part of query string or URL but it is part of request.

adeneo
  • 312,895
  • 29
  • 395
  • 388
  • See http://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript – Frank van Puffelen Aug 26 '14 at 15:41
  • @FrankvanPuffelen The question you linked to isn't related. – Brad Aug 26 '14 at 15:42
  • @Brad: Are you sure? "Accessing the web page's HTTP Headers in JavaScript". I must admit, I immediately clicked through to http://stackoverflow.com/questions/12258705/how-can-i-read-the-current-headers-without-making-a-new-request-with-js, which has the same answer as you gave: "not possible, unless". – Frank van Puffelen Aug 26 '14 at 17:51
  • @FrankvanPuffelen That question seems to be asking about AJAX requests, where this one is asking about POST data for the JavaScript request itself. While the other answer mentions this, the questions are different and therefore not a duplicate. There are many similar questions that have the same answers, but to be closed as a duplicate the questions must be identical in substance. – Brad Aug 26 '14 at 17:53
  • Ah... hold on, I see what you mean. I missed that this is looking for the **request** "headers". That is indeed different (though the answer is the same). – Frank van Puffelen Aug 26 '14 at 17:55

1 Answers1

0

This isn't possible, unless the server were to include this value in the content of pwd.html itself. This requires something server-side like PHP or Node.js.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • When I see the the generator URL its something like this: "host:port/pwd.html?type=Msg=8 APP_REQ=324823823" Do you know why does the content like this and whats it called or any other information ? – Manish Acharya Aug 26 '14 at 16:04
  • 1
    @ManishAcharya In your example above, `APP_REQ-324823823` is simply the POST body. – Brad Aug 26 '14 at 17:54