首页 > 代码库 > Refused to set unsafe header "Connection"

Refused to set unsafe header "Connection"

参考 http://stackoverflow.com/questions/7210507/ajax-post-error-refused-to-set-unsafe-header-connection

使用ajax时,chrome报出异常:Refused to set unsafe header "Connection"。

xmlHttp.setRequestHeader("Content-length", params.length);xmlHttp.setRequestHeader("Connection", "close");

在XMLHttpRequest不允许设置一些headers,他们会被浏览器自动设置。

Refused to set unsafe header "Connection"