草庐IT

openshift-origin

全部标签

javascript - XMLHttpRequest 无法加载,请求的资源上不存在 'Access-Control-Allow-Origin' header

这个问题在这里已经有了答案:Howtomakecross-domainAJAXcallstoGoogleMapsAPI?(1个回答)关闭6年前。XMLHttpRequestcannotloadhttp://maps.googleapis.com/maps/api/distancematrix/xml?origins=Affenhausen&destinations=Achenkirch&mode=driving&language=de-DE&sensor=false.No'Access-Control-Allow-Origin'headerispresentontherequested

javascript - Access-Control-Allow-Origin 不适用于同一域内的 iframe

我正在尝试访问子域中的iframe并遇到跨域错误。这是示例.mydomain.com/iframe_test.html的代码:$(document).ready(function(){setTimeout(function(){$('#innerdiv',$('iframe').contents()).hide();},5000);});这是example2.mydomain.com/welcome.php的代码:hello$('#innerdiv',$('iframe').contents()).hide()行执行时,出现如下错误:UncaughtSecurityError:Fail

javascript - JS : Call a function after another without touching the original function?

我正在尝试在特定页面上扩展第三方库,但我不想更改任何第三方代码。我知道第三方库在发生某些事情时调用的函数的名称,所以如果我希望自己的自定义代码在此之后执行,我该怎么做?第三方库有:functioneventFinished(args){//librarystuffhere}现在,如果这是我自己的代码,我会这样做:functioneventFinished(args){//librarystuffhereMyCustomFunction();}但是,它不是,我也不想覆盖库存库代码。那么有没有办法在不触及原始功能代码的情况下执行上述操作?我会引用函数本身,仅此而已。编辑:我应该提到声明的函

javascript - Vue 和 Axios CORS 错误 No 'Access-Control-Allow-Origin' header is present on the requested resource

这个问题在这里已经有了答案:XMLHttpRequestcannotloadXXXNo'Access-Control-Allow-Origin'header(11个答案)关闭4年前。我目前遇到上述错误,我正在使用Axios向外部API发出GET请求。看完Mozilla文档,做了很多研究并尝试了不同的选择,我仍然没有任何改善。我已经将代码剥离回到基础:axios.get('URL.com',{headers:{Access-Control-Allow-Origin:*},auth:{username:'username',password:'password'},}).then(func

javascript - CORS header 'Access-Control-Allow-Origin' 不匹配...但确实匹配‼

我正在用Java制作一个非常简单的JSONAPI。它实际上是一个提供对象坐标的ProjectZomboidmod。这是我的HTTP处理程序的样子:publicclassJSONZomboidimplementsHttpHandler{@Overridepublicvoidhandle(HttpExchanget)throwsIOException{//HEADERSHeadersheaders=t.getResponseHeaders();headers.set("Content-Type","text/json");headers.set("Access-Control-Allow-

javascript - JavaScript 的 Fetch API 的 "same-origin"和 "no-cors"有什么区别?

我认为同源意味着没有CORS,反之亦然。JavaScript的FetchAPI的mode选项的两个选项有什么区别?此外,在规范中,它说:Eventhoughthedefaultrequestmodeis"no-cors",standardsarehighlydiscouragedfromusingitfornewfeatures.Itisratherunsafe.为什么不安全?来源:https://fetch.spec.whatwg.org/#requests 最佳答案 使用same-origin,您只能对您的来源执行请求,否则请求

javascript - AJAX 请求获取 "No ' Access-Control-Allow-Origin' header is present on the requested resource"错误

我尝试发送GET在jQueryAJAX请求中请求。$.ajax({type:'GET',url:/**/,dataType:'text/html',success:function(){alert("Success");},error:function(){alert("Error");},});但是,无论我尝试过什么,我都得到了XMLHttpRequestcannotload.No'Access-Control-Allow-Origin'headerispresentontherequestedresource.Origin'http://localhost:7776'isthere

javascript - 使用 XMLHttpRequest 继续收到 No 'Access-Control-Allow-Origin' 错误

我本来可以通过使用jQuery$.ajax函数来解决这个问题,但在这种情况下,jQuery不是选项。相反,我将使用CORS请求。我觉得响应请求的网络服务器有问题,我很难找出问题所在。这是我创建CORS请求的代码varhttpRequest=newXMLHttpRequest();httpRequest.open('POST',url,true);httpRequest.setRequestHeader('Access-Control-Allow-Origin','*');httpRequest.setRequestHeader('Content-Type','application/j

javascript - 谷歌云端硬盘 API OAuth 2.0;错误 : origin_mismatch

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭8年前。Improvethisquestion我在为我的网站创建有效的googledriveAPI时遇到问题。我可能听起来像个菜鸟,但我在我的主ftp目录中创建了一个名为quickstart.html的文件,并复制并粘贴了https://developers.google.com/drive/qui

javascript - Play 2.0.1 并设置 Access-Control-Allow-Origin

我有一个Play2.0.1应用程序,我想使用托管在其他域上的Javascript调用它。我的Javascript调用失败:Originhttp://mydomain.comisnotallowedbyAccess-Control-Allow-Origin.我找到了很多关于如何在Play1中设置正确的HTTPheader的示例,但没有找到适用于Play2.0.1的任何示例。阅读文档(http://www.playframework.org/documentation/2.0.2/JavaResponse)后,我尝试了以下方法只是为了让事情正常进行:publicstaticResultmy