Javascript Post在IE9上工作不正常
我正在尝试发布表单,并在目标iframe中使用纯HTML接收服务器响应。到目前为止,我得到的是:Javascript Post在IE9上工作不正常,javascript,html,node.js,internet-explorer-9,Javascript,Html,Node.js,Internet Explorer 9,我正在尝试发布表单,并在目标iframe中使用纯HTML接收服务器响应。到目前为止,我得到的是: <iframe name="iframe" id="iframe" onload="loaded()" style="display:none"></iframe> 我可以在IE9网络监视器中跟踪内容类型为“application/json” 有什么想法吗?这似乎是一个糟糕的文件mime类型问题。检查服务器是否实际返回应用程序/json输出 以下是一些类似的帖子:
<iframe name="iframe" id="iframe" onload="loaded()" style="display:none"></iframe>
我可以在IE9网络监视器中跟踪内容类型为“application/json”
有什么想法吗?这似乎是一个糟糕的文件mime类型问题。检查服务器是否实际返回应用程序/json输出 以下是一些类似的帖子:
result.ContentEncoding = System.Text.Encoding.UTF8;
result.ContentType = "application/json; charset=UTF-8
在这种情况下,您应该注意chrome或firefox发出的与ie9或IE8不同的post请求 chrome将先发送选项请求测试连接,然后发送post请求,但IE并没有这样做,所以您应该尝试对响应进行更多设置,如下所示
response.header("Content-Type", "application/json;charset=utf-8");
response.header("Access-Control-Allow-Methods","POST,GET,OPTIONS");
response.send("try");
注意,你应该先回应
if(request.method==='OPTIONS')
response.send(200);
希望此信息对您有所帮助服务器响应头的内容类型为“application/json”。Chrome和FFit处理得很好,这似乎是一篇类似的帖子,你确定你正确设置了内容类型吗?我的服务器是nodejs服务器,正确设置了res.writeHead(200,{'content type':'application/json'});我试图更改为res.writeHead(200,{'Content-Type':'application/json;charset=UTF-8'});在ie9网络控制台中,我看到respense的内容类型是“application/json”,并正确地更改为“application/json”;chardset=utf-8I也对另一个答案进行了注释,但内容类型为indeed“application/json”。正如我在问题中所说,它由Chrome和FF正确处理。它可能在Chrome/Firefox上工作,因为它们通常具有智能类型识别。尝试卷曲或设置所需的URL,并打印服务器实际返回的标题。您是使用node.js作为服务器还是前面有类似nginx的东西?
result.ContentEncoding = System.Text.Encoding.UTF8;
result.ContentType = "application/json; charset=UTF-8
response.header("Content-Type", "application/json;charset=utf-8");
response.header("Access-Control-Allow-Methods","POST,GET,OPTIONS");
response.send("try");
if(request.method==='OPTIONS')
response.send(200);