<small id='oehuJ'></small><noframes id='oehuJ'>

    • <bdo id='oehuJ'></bdo><ul id='oehuJ'></ul>

    <legend id='oehuJ'><style id='oehuJ'><dir id='oehuJ'><q id='oehuJ'></q></dir></style></legend>
    <tfoot id='oehuJ'></tfoot>

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

      为什么 Chrome 会取消 CORS OPTION 请求

      时间:2023-05-16
      <i id='U6X7y'><tr id='U6X7y'><dt id='U6X7y'><q id='U6X7y'><span id='U6X7y'><b id='U6X7y'><form id='U6X7y'><ins id='U6X7y'></ins><ul id='U6X7y'></ul><sub id='U6X7y'></sub></form><legend id='U6X7y'></legend><bdo id='U6X7y'><pre id='U6X7y'><center id='U6X7y'></center></pre></bdo></b><th id='U6X7y'></th></span></q></dt></tr></i><div id='U6X7y'><tfoot id='U6X7y'></tfoot><dl id='U6X7y'><fieldset id='U6X7y'></fieldset></dl></div>

      <small id='U6X7y'></small><noframes id='U6X7y'>

      <legend id='U6X7y'><style id='U6X7y'><dir id='U6X7y'><q id='U6X7y'></q></dir></style></legend>
      1. <tfoot id='U6X7y'></tfoot>

          • <bdo id='U6X7y'></bdo><ul id='U6X7y'></ul>

              <tbody id='U6X7y'></tbody>
              • 本文介绍了为什么 Chrome 会取消 CORS OPTION 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                在我的应用程序中,我正在创建从 HTTP 到 HTTPS 的 AJAX 请求.这意味着我需要 CORS.因此,我向 jQuery.ajax 添加了一些标头和参数并对其进行了测试.在 Firefox 中一切正常,但在 Chrome 中却不行.Chrome 杀死"每个预请求的请求(选项).

                in my app I'm creating AJAX request from HTTP to HTTPS. This means I need CORS. So I add some headers and params to jQuery.ajax and test it. In Firefox everythings works OK, but in Chrome not. Chrome "kill" every preflighed request (OPTIONS).

                jQuery 脚本:

                $(document).on('click', 'a.ajax', function(e) {
                    e.preventDefault();
                    $.ajax(this.href, {
                        type: 'GET',
                        dataType: 'json',
                        crossDomain: false,
                        headers: {'X-Requested-With': 'XMLHttpRequest'},
                        xhrFields: {
                            withCredentials: true
                        }
                    });
                    return false;
                });
                

                HTTP 转储:

                > OPTIONS /foo HTTP/1.1
                > User-Agent: curl/7.29.0
                > Host: local.bar.cz
                > Accept: */*
                > Access-Control-Request-Headers:accept, origin, x-requested-with
                > Access-Control-Request-Method:GET
                > Origin:http://local.bar.cz
                > 
                < HTTP/1.1 204
                < Server: nginx/1.2.7
                < Date: Wed, 27 Feb 2013 15:06:54 GMT
                < Content-Type: text/html; charset=utf-8
                < Connection: keep-alive
                < X-Powered-By: Nette Framework
                < X-Frame-Options: SAMEORIGIN
                < Access-Control-Allow-Origin: http://local.bar.cz
                < Access-Control-Allow-Credentials: true
                < Access-Control-Allow-Headers: accept, origin, x-requested-with
                < Access-Control-Allow-Methods: OPTIONS, GET, POST, HEAD
                < 
                

                有人知道为什么 chrome 会终止这个请求吗?

                any one knows why chrome kill this request?

                推荐答案

                可能你的 https 服务器有一个不受信任的证书.如果是这样,请先尝试使用浏览器访问该 URL,并接受不受信任的连接.

                Maybe your https server has an untrusted certificate. If so, try accessing to the URL with your browser first, and accepting the untrusted connection.

                这篇关于为什么 Chrome 会取消 CORS OPTION 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:IE10 和 Image/Canvas 的跨域资源共享 (CORS) 问题 下一篇:拒绝设置不安全的标头“Origin"使用谷歌浏览器的 xmlHttpRequest 时

                相关文章

                    <bdo id='8DEHU'></bdo><ul id='8DEHU'></ul>

                1. <legend id='8DEHU'><style id='8DEHU'><dir id='8DEHU'><q id='8DEHU'></q></dir></style></legend>
                  <i id='8DEHU'><tr id='8DEHU'><dt id='8DEHU'><q id='8DEHU'><span id='8DEHU'><b id='8DEHU'><form id='8DEHU'><ins id='8DEHU'></ins><ul id='8DEHU'></ul><sub id='8DEHU'></sub></form><legend id='8DEHU'></legend><bdo id='8DEHU'><pre id='8DEHU'><center id='8DEHU'></center></pre></bdo></b><th id='8DEHU'></th></span></q></dt></tr></i><div id='8DEHU'><tfoot id='8DEHU'></tfoot><dl id='8DEHU'><fieldset id='8DEHU'></fieldset></dl></div>
                2. <small id='8DEHU'></small><noframes id='8DEHU'>

                    <tfoot id='8DEHU'></tfoot>