仅限Safari:请求标头字段Access-Control-Allow-Headers不允许使用Cache-Control

时间:2016-03-23 18:10:48

标签: javascript jquery ajax safari cache-control

$.ajax({
    method: "GET",
    url: "http://pokeapi.co/api/v2/pokemon?limit=151"
  }).done(function(data) {
    console.log(data);
  });

在Chrome中运行良好。

Safari返回:

Failed to load resource: Request header field Cache-Control is not allowed by Access-Control-Allow-Headers.

XMLHttpRequest cannot load http://pokeapi.co/api/v2/pokemon/?limit=151. Request header field Cache-Control is not allowed by Access-Control-Allow-Headers.

我尝试过ajaxSetup beforeSend使“Cache-Control”无效。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您是否尝试将请求更改为https而不是http?这帮助我昨天,但我删除了我的缓存,无法找到我读过的mozilla文档。我会尝试找到它并发布它

找到https://developer.mozilla.org/en-US/docs/Security/Mixed_content/How_to_fix_website_with_mixed_content