【发布时间】:2015-11-24 16:52:02
【问题描述】:
在以下代码中,自定义标头 (If-Modified-Since) 使 ajax 失败,状态为 HTTP/1.1 405 Not Allowed 的 OPTIONS 预检请求。但是,如果我删除标头,请求会按预期工作(我不确定是否根本没有发送 OPTIONS 或开发控制台只是不显示它)。为什么会这样? (与 googleapis 托管 jquery 的情况相同)。
http = new XMLHttpRequest();
http.open('GET', 'http://code.jquery.com/jquery-2.1.4.min.js');
http.setRequestHeader('If-Modified-Since', 'Sat, 29 Oct 1994 19:43:31 GMT')
http.send();
另外,有没有办法将 xhr 中的这个标头发送到 jquery cdn 以获得304 响应状态?
【问题讨论】:
标签: javascript ajax http-headers cors browser-cache