<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 请求

      Why Chrome cancel CORS OPTION request(为什么 Chrome 会取消 CORS OPTION 请求)
      <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 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
                How do I get the HTTP status code with jQuery?(如何使用 jQuery 获取 HTTP 状态码?)
                quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
                How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)
                WebKit quot;Refused to set unsafe header #39;content-length#39;quot;(WebKit “拒绝设置不安全的标头‘内容长度’)
                $.ajax call working fine in IE8 and Doesn#39;t work in firefox and chrome browsers($.ajax 调用在 IE8 中运行良好,但在 Firefox 和 chrome 浏览器中不起作用)

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

                    • <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>
                    • <small id='8DEHU'></small><noframes id='8DEHU'>

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