05-06-2011 03:25 PM - edited 05-07-2011 09:50 AM
Hi :-),
I'm trying to perform an xmlhttprequest sending some custom headers. I've done two different tests, one modifying UserAgent header and a second one adding myself a specific header.
The server side part of the application basically echoes back whatever it receives. The application compiles and executes correctly and in fact I can retrieve the rest of the header values but It seems I cannot modify UserAgent or add a specific header. Is this true or am I doing something wrong?
My code more or less looks like:
var reqUrl = "https://xxxx";
var httpReq = new XMLHttpRequest();
httpReq.onreadystatechange = handleStateChange;
httpReq.open('GET', reqUrl, false);
httpReq.setRequestHeader('User-Agent','CustomAgen
httpReq.setRequestHeader('MyHeader','HeaderValue'
httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpReq.setRequestHeader('Connection', 'close');
httpReq.send();
if (httpReq.readyState == 4) {
query1.innerHTML = httpReq.responseText;
}
Regards
08-09-2011 08:46 AM
Overriding the user agent is not allowed. This is not a bug.
http://www.w3.org/TR/XMLHttpRequest/#the-setreques
08-09-2011 12:14 PM
Ditto
You sound like you've trying a XMPP hack
No help here
03-15-2012 10:20 PM
So is there no way to change the user agent in WebWorks?
I'm trying to add a channel requested by a customer to my Tablet TV app but it blocks the Playbook because it's a "mobile browser" - if changing the user agent isn't possible, is there any other way around this?