JavaScript: Don't send any header
Using Javascript I would like to send some data to a server. Tried using XMLHttpRequest
, but oh wonder, t开发者_开发知识库he data gets sent with normal HTTP headers.
Is there any way to avoid the browser sending any additional data like http headers? This would let Javascript have some socket-facility. I thought about trying to override the object XMLHttpRequest's methods. But I don't know if this is possible and how portable it is.
Maybe it doesn't really have to do anything with it... but in HTML5 this really could get useful.
Any idea to work it around? Any help appreciated.
Thanks and good night. regards
As far as I know, that's no possible. You can add additional headers, but you can't disable the standard ones.
What you could do is to make a standard XmlHttpRequest request to your server, then use server side scripts to make the actual request you want.
I don't think you can do that or it would break a lot of things (server wouldn't like it). It has the string "Http" in it for a reason. Without headers its not HTTP. But that's why they came up the the new WebSocket interface. Maybe you could start using that.
精彩评论