• <bdo id='HHqMX'></bdo><ul id='HHqMX'></ul>
  • <i id='HHqMX'><tr id='HHqMX'><dt id='HHqMX'><q id='HHqMX'><span id='HHqMX'><b id='HHqMX'><form id='HHqMX'><ins id='HHqMX'></ins><ul id='HHqMX'></ul><sub id='HHqMX'></sub></form><legend id='HHqMX'></legend><bdo id='HHqMX'><pre id='HHqMX'><center id='HHqMX'></center></pre></bdo></b><th id='HHqMX'></th></span></q></dt></tr></i><div id='HHqMX'><tfoot id='HHqMX'></tfoot><dl id='HHqMX'><fieldset id='HHqMX'></fieldset></dl></div>
    <tfoot id='HHqMX'></tfoot>
      <legend id='HHqMX'><style id='HHqMX'><dir id='HHqMX'><q id='HHqMX'></q></dir></style></legend>

      1. <small id='HHqMX'></small><noframes id='HHqMX'>

        如何使用访问控制允许来源?它只是在html头标签之

        时间:2023-09-03

      2. <legend id='IeC3I'><style id='IeC3I'><dir id='IeC3I'><q id='IeC3I'></q></dir></style></legend>
          • <small id='IeC3I'></small><noframes id='IeC3I'>

              <i id='IeC3I'><tr id='IeC3I'><dt id='IeC3I'><q id='IeC3I'><span id='IeC3I'><b id='IeC3I'><form id='IeC3I'><ins id='IeC3I'></ins><ul id='IeC3I'></ul><sub id='IeC3I'></sub></form><legend id='IeC3I'></legend><bdo id='IeC3I'><pre id='IeC3I'><center id='IeC3I'></center></pre></bdo></b><th id='IeC3I'></th></span></q></dt></tr></i><div id='IeC3I'><tfoot id='IeC3I'></tfoot><dl id='IeC3I'><fieldset id='IeC3I'></fieldset></dl></div>
              <tfoot id='IeC3I'></tfoot>

                  <bdo id='IeC3I'></bdo><ul id='IeC3I'></ul>
                    <tbody id='IeC3I'></tbody>
                • 本文介绍了如何使用访问控制允许来源?它只是在html头标签之间吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我一直在阅读有关 Access-Control-Allow-Origin 的内容,因为它似乎可以有效地允许跨域请求,因为我可以访问外部站点.我的问题是如何使用 Access-Control-Allow-Origin 来允许跨域请求.我试过这个(别笑)(顺便说一句,我想要一个数字,返回 1 或 0)

                  I've been reading about Access-Control-Allow-Origin because it seems effective at allowing cross domain requests since I have access to the external site. My question ism how do I use Access-Control-Allow-Origin to allow cross domain requests. I tried this (don't laugh) (by the way all I want is for a single number, 1 or 0 to be returned)

                  <html>
                  <head>
                  Access-Control-Allow-Origin: *
                  </head>
                  <body>
                  1
                  </body>
                  </html>
                  

                  我接近了吗?谢谢你的帮助.如果有更简单的方法来执行简单的跨域请求,请告诉我.

                  Am I close? Thanks for your help. If there is an easier way to do a simple cross-domain request let me know.

                  推荐答案

                  这是一个HTTP头.您将配置您的网络服务器或网络应用程序以理想地发送此标头.也许在 htaccess 或 PHP 中.

                  That is an HTTP header. You would configure your webserver or webapp to send this header ideally. Perhaps in htaccess or PHP.

                  或者你也可以使用

                  Alternatively you might be able to use

                  <head>...<meta http-equiv="Access-Control-Allow-Origin" content="*">...</head>
                  

                  我不知道这是否可行.并非所有 HTTP 标头都可以直接在 HTML 中配置.

                  I do not know if that would work. Not all HTTP headers can be configured directly in the HTML.

                  这可以替代许多 HTTP 标头,但请参阅下面的 @EricLaw 的评论.这个特定的标头是不同的.

                  This works as an alternative to many HTTP headers, but see @EricLaw's comment below. This particular header is different.

                  警告

                  这个答案是关于如何设置标题的.我对允许跨域请求一无所知.

                  This answer is strictly about how to set headers. I do not know anything about allowing cross domain requests.

                  关于 HTTP 标头

                  每个请求和响应都有标头.浏览器将其发送到网络服务器

                  Every request and response has headers. The browser sends this to the webserver

                  GET /index.htm HTTP/1.1
                  

                  然后是标题

                  Host: www.example.com
                  User-Agent: (Browser/OS name and version information)
                  .. Additional headers indicating supported compression types and content types and other info
                  

                  然后服务器发送响应

                  Content-type: text/html
                  Content-length: (number of bytes in file (optional))
                  Date: (server clock)
                  Server: (Webserver name and version information)
                  

                  可以配置其他头文件,例如 Cache-Control,这完全取决于您的语言(PHP、CGI、Java、htaccess)和网络服务器(Apache 等).

                  Additional headers can be configured for example Cache-Control, it all depends on your language (PHP, CGI, Java, htaccess) and webserver (Apache, etc).

                  这篇关于如何使用访问控制允许来源?它只是在html头标签之间吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:跨域资源共享 (CORS) 概念 下一篇:通过在浏览器中运行的 JavaScript 将数据推送到

                  相关文章

                  最新文章

                • <i id='qRYnP'><tr id='qRYnP'><dt id='qRYnP'><q id='qRYnP'><span id='qRYnP'><b id='qRYnP'><form id='qRYnP'><ins id='qRYnP'></ins><ul id='qRYnP'></ul><sub id='qRYnP'></sub></form><legend id='qRYnP'></legend><bdo id='qRYnP'><pre id='qRYnP'><center id='qRYnP'></center></pre></bdo></b><th id='qRYnP'></th></span></q></dt></tr></i><div id='qRYnP'><tfoot id='qRYnP'></tfoot><dl id='qRYnP'><fieldset id='qRYnP'></fieldset></dl></div>

                  <tfoot id='qRYnP'></tfoot>
                    <bdo id='qRYnP'></bdo><ul id='qRYnP'></ul>

                    1. <legend id='qRYnP'><style id='qRYnP'><dir id='qRYnP'><q id='qRYnP'></q></dir></style></legend>
                    2. <small id='qRYnP'></small><noframes id='qRYnP'>