我尝试在IE10中使用XHR发送FormData时遇到了荒谬的问题。 我发现FormData在特定页面中被忽略,代码如下所示。
可以猜到什么是理由? 页面具有相同的DOCTYPE。
var o = new FormData();
o.append("test", "1234");
var xhr = new XMLHttpRequest();
xhr.open("POST", "/files");
xhr.send(o);
通常情况下:
POST https://github.com/files HTTP/1.1
Accept: */*
Content-Type: multipart/form-data; boundary=---------------------------7de290c360a6e
Referer: (something)
Accept-Language: ko-KR,ja;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1;; APCPMS=^N20120502090046254556C65BBCE3E22DEE3F_477^; Trident/6.0; TCO_20140226091802)
Host: github.com
Content-Length: 143
DNT: 1
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: (deleted)
-----------------------------7de290c360a6e
Content-Disposition: form-data; name="test"
1234
-----------------------------7de290c360a6e--
异常情况:
POST http://foo.bar.com/files HTTP/1.1
Accept: */*
Content-Type: multipart/form-data; boundary=---------------------------7de1b67c0afe
Referer: http://foo.bar.com/page
Accept-Language: ko-KR,ja;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1;; APCPMS=^N20120502090046254556C65BBCE3E22DEE3F_477^; Trident/6.0; TCO_20140226091802)
Connection: Keep-Alive
Content-Length: 0
DNT: 1
Host: dhive.nhnre.com:8888
Pragma: no-cache
Cookie: (deleted)