0

In Java I am able to specify http header using

 client = new DefaultHttpClient();
 HttpGet get = new HttpGet(url);
 get.addHeader(key, value);

Now I need to create an html form, how do I pass the same data information?

tribal
  • 653
  • 2
  • 13
  • 26

1 Answers1

0

You cannot, with pure HTML, cause the user's browser to send a particular header (other than Post-Data and so on).

If you need to send HTTP headers you'll have to use a Javascript XMLHTTPRequest or other dynamic device. See this SO question.

Community
  • 1
  • 1
Borealid
  • 95,191
  • 9
  • 106
  • 122
  • Thanks for the info. Do you have a short example? – tribal Jan 26 '12 at 18:29
  • @tribal You mean like the ones at the link I provided? – Borealid Jan 26 '12 at 18:30
  • The link provided has links which link to other links. So each reply seem very incomplete. I am pursuing the links, first learning about XHR. Not knowing how long it will take, I ask for a quick short and complete example. Thanks. – tribal Jan 26 '12 at 18:55