Closed jessechk closed 8 years ago
Ok, this seems to be part of your xhook
library, perhaps I should move the issue there?
Thanks for the report @jessechk
I just checked and sending:
var x = new XMLHttpRequest(); x.open("GET", "/"); x.setRequestHeader("Foo",""); x.send();
In chrome, sends an empty "Foo" header to the server, so it seems we need need to disallow it only in IE.
We'll need to determine which versions of IE don't support empty header values then we can put that if statement in.
If you could run that snippet in different versions of IE and report which versions error that would be great, otherwise I can look into it into next week
Edit: firefox seems to allow it (doesnt throw), though prevents it from actually going to the server https://bugzilla.mozilla.org/show_bug.cgi?id=929760
I've tested IE 8-11 and none of them throw an error on that snippet. The error does trigger when the Foo
value is an empty string in almost all browsers, however. I thought it might have to do with using $http in AngularJS - I created standalone tests and none of them seem to have an issue. This might be IE's JS engine being misleading about where the error really is. I'll do some more testing next week, but you can close this issue if you want.
Ah right, my mistake - its the header name, not the value causing the issue – yep that should be disallowed
On Sat, Jan 30, 2016 at 2:19 PM Jesse Hoek notifications@github.com wrote:
I've tested IE 8-11 and none of them throw an error on that snippet. The error does trigger when the Foo value is an empty string in almost all browsers, however. I thought it might have to do with using $http in AngularJS - I created standalone tests and none of them seem to have an issue. This might be IE's JS engine being misleading about where the error really is. I'll do some more testing next week, but you can close this issue if you want.
— Reply to this email directly or view it on GitHub https://github.com/jpillora/xdomain/issues/180#issuecomment-177056031.
I had same problem but I solved I added "document.cookie = '_a=3'" to my slave html (proxy.html) because in my case, Slave-Cookie was empty string and Master-Cookie was not.
I guess Empty string value is disallowed in IE8.
First of all, thanks for the great plugin, it makes working with old IE a little less miserable!
I ran into an issue with IE8 where I'm getting an
Invalid Argument
error in the IE console. This happens on line477
ofxdomain.js
. I looked inside therequest.headers
array, and it seems that there are entriesMaster-Cookie: ""
, andSlave-Cookie: ""
. IE8 seems to be rejecting adding an empty string as a header value inxhr.setRequestHeader
.I can't seem to reproduce this error on a standalone page, it only happens when I load a page from my WordPress project. I think the difference is that WP loads some cookies on the page. I don't need these cookies to be sent along with any requests however.
I tried setting
xdomain.cookies = {master: null, slave: null};
butMaster-Cookie: ""
andSlave-Cookie: ""
are still in the headers, which causes IE8 to crash the script.I was able to fix this myself by changing line 447 from
xhr.setRequestHeader(header, value);
toif (value != "") xhr.setRequestHeader(header, value);
I'm not sure if there's a way to get rid of these empty headers in the first place.