pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <legend id='6aRl4'><style id='6aRl4'><dir id='6aRl4'><q id='6aRl4'></q></dir></style></legend>
    • <bdo id='6aRl4'></bdo><ul id='6aRl4'></ul>

    1. <tfoot id='6aRl4'></tfoot>

        <small id='6aRl4'></small><noframes id='6aRl4'>

      1. <i id='6aRl4'><tr id='6aRl4'><dt id='6aRl4'><q id='6aRl4'><span id='6aRl4'><b id='6aRl4'><form id='6aRl4'><ins id='6aRl4'></ins><ul id='6aRl4'></ul><sub id='6aRl4'></sub></form><legend id='6aRl4'></legend><bdo id='6aRl4'><pre id='6aRl4'><center id='6aRl4'></center></pre></bdo></b><th id='6aRl4'></th></span></q></dt></tr></i><div class="d17f95n" id='6aRl4'><tfoot id='6aRl4'></tfoot><dl id='6aRl4'><fieldset id='6aRl4'></fieldset></dl></div>
      2. 使用 XMLHttpRequest 不斷收到 No 'Access-Control-All

        Keep getting No #39;Access-Control-Allow-Origin#39; error with XMLHttpRequest(使用 XMLHttpRequest 不斷收到 No Access-Control-Allow-Origin 錯誤)
        • <i id='ArR83'><tr id='ArR83'><dt id='ArR83'><q id='ArR83'><span id='ArR83'><b id='ArR83'><form id='ArR83'><ins id='ArR83'></ins><ul id='ArR83'></ul><sub id='ArR83'></sub></form><legend id='ArR83'></legend><bdo id='ArR83'><pre id='ArR83'><center id='ArR83'></center></pre></bdo></b><th id='ArR83'></th></span></q></dt></tr></i><div class="fxlfvvv" id='ArR83'><tfoot id='ArR83'></tfoot><dl id='ArR83'><fieldset id='ArR83'></fieldset></dl></div>
        • <tfoot id='ArR83'></tfoot>

        • <legend id='ArR83'><style id='ArR83'><dir id='ArR83'><q id='ArR83'></q></dir></style></legend>

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

            <bdo id='ArR83'></bdo><ul id='ArR83'></ul>

                <tbody id='ArR83'></tbody>

                  本文介紹了使用 XMLHttpRequest 不斷收到 No 'Access-Control-Allow-Origin' 錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我會通過使用 jQuery $.ajax 函數來解決這個問題,但在這種情況下,jQuery 不是選項.相反,我將使用 CORS 請求.我覺得響應請求的網絡服務器有問題,我很難找出問題所在.

                  I would have solved this issue by using jQuery $.ajax function but in this case jQuery is not option. Instead I am going with CORS request. I feel there is something wrong with the webserver that is responding to the request and I am having a hard time figuring out what the issue is.

                  這是我創建 CORS 請求的代碼

                  Here is my code for creating the CORS request

                  var httpRequest = new XMLHttpRequest();
                  httpRequest.open('POST', url, true);
                  httpRequest.setRequestHeader( 'Access-Control-Allow-Origin', '*');
                  httpRequest.setRequestHeader( 'Content-Type', 'application/json' );
                  httpRequest.onerror = function(XMLHttpRequest, textStatus, errorThrown) {
                    console.log( 'The data failed to load :(' );
                    console.log(JSON.stringify(XMLHttpRequest));
                  };
                  httpRequest.onload = function() {
                    console.log('SUCCESS!');
                  }
                  

                  這是 console.log 錯誤:

                  Here is the console.log error:

                  XMLHttpRequest 無法加載http://test.testhost.com/testpage.請求頭域Access-Control-Allow-Origin 不允許訪問控制允許標頭.

                  XMLHttpRequest cannot load http://test.testhost.com/testpage. Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers.

                  這是標題信息:

                  > Remote Address:**.**.***.**:80 Request
                  > URL:http://test.testdomain.com/testpage Request
                  > Request Method:OPTIONS
                  > Status Code:200 OK
                  

                  請求標頭:

                  OPTIONS /content-network HTTP/1.1
                  Host: test.testhost.com
                  Connection: keep-alive
                  Cache-Control: no-cache
                  Pragma: no-cache
                  Access-Control-Request-Method: POST
                  Origin: http://test.testdomain.com
                  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
                  Access-Control-Request-Headers: access-control-allow-origin, content-type
                  Accept: */*
                  Referer: http://test.testdomain.com/
                  Accept-Encoding: gzip,deflate,sdch
                  Accept-Language: en-US,en;q=0.8
                  

                  響應標頭:

                  HTTP/1.1 200 OK
                  Date: Thu, 14 Aug 2014 20:17:25 GMT
                  Server: Apache
                  Last-Modified: Thu, 14 Aug 2014 20:17:25 +0000
                  Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
                  ETag: "1408047445"
                  Access-Control-Allow-Origin: *
                  Access-Control-Allow-Headers: Content-Type
                  Vary: Accept-Encoding
                  Content-Encoding: gzip
                  Access-Control-Allow-Headers: origin, x-requested-with, content-type
                  Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS
                  Content-Length: 6117
                  Connection: close
                  Content-Type: text/html; charset=utf-8
                  

                  推薦答案

                  您的服務器的響應允許請求包含三個特定的 非簡單標題:

                  Your server's response allows the request to include three specific non-simple headers:

                  Access-Control-Allow-Headers:origin, x-requested-with, content-type
                  

                  但是您的請求包含服務器響應不允許的標頭:

                  but your request has a header not allowed by the server's response:

                  Access-Control-Request-Headers:access-control-allow-origin, content-type
                  

                  在 CORS 請求中發送的所有非簡單標頭必須由 Access-Control-Allow-Headers 響應標頭明確允許.服務器的 CORS 響應不允許在您的請求中發送不必要的 Access-Control-Allow-Origin 標頭.這正是...Access-Control-Allow-Headers 不允許"錯誤消息試圖告訴您的內容.

                  All non-simple headers sent in a CORS request must be explicitly allowed by the Access-Control-Allow-Headers response header. The unnecessary Access-Control-Allow-Origin header sent in your request is not allowed by the server's CORS response. This is exactly what the "...not allowed by Access-Control-Allow-Headers" error message was trying to tell you.

                  請求沒有理由有這個標頭:它什么都不做,因為 Access-Control-Allow-Origin 是一個 response 標頭,而不是請求標頭.

                  There is no reason for the request to have this header: it does nothing, because Access-Control-Allow-Origin is a response header, not a request header.

                  解決方案:刪除向您的請求添加 Access-Control-Allow-Origin 標頭的 setRequestHeader 調用.

                  Solution: Remove the setRequestHeader call that adds a Access-Control-Allow-Origin header to your request.

                  這篇關于使用 XMLHttpRequest 不斷收到 No 'Access-Control-Allow-Origin' 錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)

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

                        <small id='5s7c0'></small><noframes id='5s7c0'>

                        <tfoot id='5s7c0'></tfoot>

                            <tbody id='5s7c0'></tbody>
                          • 主站蜘蛛池模板: 杭州中央空调维修_冷却塔/新风机柜/热水器/锅炉除垢清洗_除垢剂_风机盘管_冷凝器清洗-杭州亿诺能源有限公司 | 阿尔法-MDR2000无转子硫化仪-STM566 SATRA拉力试验机-青岛阿尔法仪器有限公司 | 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 琉璃瓦-琉璃瓦厂家-安徽盛阳新型建材科技有限公司 | 提升海外网站流量,增加国外网站访客UV,定制海外IP-访客王 | Copeland/谷轮压缩机,谷轮半封闭压缩机,谷轮涡旋压缩机,型号规格,技术参数,尺寸图片,价格经销商 CTP磁天平|小电容测量仪|阴阳极极化_双液系沸点测定仪|dsj电渗实验装置-南京桑力电子设备厂 | PU树脂_水性聚氨酯树脂_聚氨酯固化剂_聚氨酯树脂厂家_宝景化工 | 色谱柱-淋洗液罐-巴罗克试剂槽-巴氏吸管-5ml样品瓶-SBS液氮冻存管-上海希言科学仪器有限公司 | 「钾冰晶石」氟铝酸钾_冰晶石_氟铝酸钠「价格用途」-亚铝氟化物厂家 | 气动球阀_衬氟蝶阀_调节阀_电动截止阀_上海沃托阀门有限公司 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 陕西鹏展科技有限公司| 南京和瑞包装有限公司| 成都治疗尖锐湿疣比较好的医院-成都治疗尖锐湿疣那家医院好-成都西南皮肤病医院 | 长沙中央空调维修,中央空调清洗维保,空气能热水工程,价格,公司就找维小保-湖南维小保环保科技有限公司 | 耐酸泵,耐酸泵厂家-淄博华舜耐腐蚀真空泵| 太阳能发电系统-太阳能逆变器,控制器-河北沐天太阳能科技首页 | 陕西鹏展科技有限公司| 北京乾茂兴业科技发展有限公司 | 聚氨酯复合板保温板厂家_廊坊华宇创新科技有限公司 | 北京网站建设首页,做网站选【优站网】,专注北京网站建设,北京网站推广,天津网站建设,天津网站推广,小程序,手机APP的开发。 | 广州印刷厂_广州彩印厂-广州艺彩印务有限公司| ETFE膜结构_PTFE膜结构_空间钢结构_膜结构_张拉膜_浙江萬豪空间结构集团有限公司 | 雷达液位计_超声波风速风向仪_雨量传感器_辐射传感器-山东风途物联网 | 伸缩节_伸缩器_传力接头_伸缩接头_巩义市联通管道厂 | 工业洗衣机_工业洗涤设备_上海力净工业洗衣机厂家-洗涤设备首页 bkzzy在职研究生网 - 在职研究生招生信息咨询平台 | 国产液相色谱仪-超高效液相色谱仪厂家-上海伍丰科学仪器有限公司 | 没斑啦-专业的祛斑美白嫩肤知识网站-去斑经验分享 | 硫化罐-电加热蒸汽硫化罐生产厂家-山东鑫泰鑫智能装备有限公司 | sfp光模块,高速万兆光模块工厂-性价比更高的光纤模块制造商-武汉恒泰通 | 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 航空障碍灯_高中低光强航空障碍灯_民航许可认证航空警示灯厂家-东莞市天翔航天科技有限公司 | 【法利莱住人集装箱厂家】—活动集装箱房,集装箱租赁_大品牌,更放心 | 滚塑PE壳体-PE塑料浮球-警示PE浮筒-宁波君益塑业有限公司 | 明渠式紫外线杀菌器-紫外线消毒器厂家-定州市优威环保 | 快速卷帘门_硬质快速卷帘门-西朗门业 | 嘉兴恒升声级计-湖南衡仪声级计-杭州爱华多功能声级计-上海邦沃仪器设备有限公司 | 尚为传动-专业高精密蜗轮蜗杆,双导程蜗轮蜗杆,蜗轮蜗杆减速机,蜗杆减速机生产厂家 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 武汉不干胶印刷_标签设计印刷_不干胶标签印刷厂 - 武汉不干胶标签印刷厂家 | AGV无人叉车_激光叉车AGV_仓储AGV小车_AGV无人搬运车-南昌IKV机器人有限公司[官网] |