【问题标题】:What is an origin header and where do I insert Access-Control-Allow-Origin? [duplicate]什么是原始标头,我应该在哪里插入 Access-Control-Allow-Origin? [复制]
【发布时间】:2011-10-21 06:50:18
【问题描述】:

可能重复:
How do I use Access-Control-Allow-Origin? Does it just go in between the html head tags?

我正在尝试允许跨域请求,但我不知道将 Access-Control-Allow-Origin 放在哪里。它是在 html 请求文件还是 index.html 中?我把这段代码放在了我的 html 请求文件中,如果这太离谱了,不要笑我。

<head>
Access-Control-Allow-Origin: *
</head>

【问题讨论】:

    标签: html header access-control


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      Access-Control-Allow-Origin不能进入head标签,它是一个html头,所以它属于php脚本。

      【讨论】:

      • 它是 HTTP 标头,而不是 HTML 标头。设置方法有很多种,PHP只是其中一种。
      猜你喜欢
      • 1970-01-01
      • 2017-06-21
      • 2016-01-11
      • 2014-03-10
      • 1970-01-01
      • 2019-07-13
      • 2018-10-28
      • 1970-01-01
      • 2021-10-29
      相关资源
      最近更新 更多