问题标签 [cors]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - Access-Control-Allow-Origin 不允许 Origin null
我制作了一个小的 xslt 文件来创建一个名为 weather.xsl 的 html 输出,代码如下:
我想将 html 输出加载到 html 文件中的 div 中,我尝试使用 jQuery 执行如下操作:
但我收到以下错误:Access-Control-Allow-Origin 不允许 Origin null。
我已经阅读了有关向 xslt 添加标头的信息,但我不知道该怎么做,所以任何帮助都将不胜感激,如果无法以这种方式加载 html 输出,请提供有关其他方法的建议这样做会很棒。
html - 使用 Plupload HTML5 运行时直接上传到 Amazon S3
我在之前的一篇文章中看到如何将 Plupload 直接上传到 Amazon S3?,这可以直接从 Pluplod Html5 运行时上传到 S3。
我通过将我的“pluploader”托管到我的 S3 存储桶中尝试了您的方法,但我仍然收到来自亚马逊的错误
加载资源失败:服务器响应状态为 405 (Method Not Allowed) XMLHttpRequest cannot load http://xxxxxxxxx.s3.amazonaws.com/。Access-Control-Allow-Origin 不允许来源http://s3.amazonaws.com
有人可以帮助我吗?谢谢
php - Symfony2 - 如何设置自定义 CORS 标头?
我想从我的 DefaultController 中为 TWIG 模板设置以下标题:
任何建议如何做到这一点?
javascript - CORS - How do 'preflight' an httprequest?
I am trying to make a cross domain HTTP request to WCF service (that I own). I have read several techniques for working with the cross domain scripting limitations. Because my service must accommodate both GET and POST requests I cannot implement some dynamic script tag whose src is the URL of a GET request. Since I am free to make changes at the server I have begun to try to implement a workaround that involves configuring the server responses to include the "Access-Control-Allow-Origin" header and 'preflight' requests with and OPTIONS request. I got the idea from this post : Getting CORS working
At the server side, my web method is adding 'Access-Control-Allow-Origin: *' to the HTTP response. I can see that responses do include this header now. My question is: How do I 'preflight' a request (OPTIONS)? I am using jQuery.getJSON to make the GET request but the browser cancels the request right away with the infamous:
Origin http://localhost is not allowed by Access-Control-Allow-Origin
Is anyone familiar with this CORS technique? What changes need to be made at the client to preflight my request?
Thanks!
jquery - 是否有 jQuery 解决方案在可用时使用 CORS,并在带有 niether 的浏览器上回退到 MSIE 上的 XDomainRequest 和 JSONP?
我傻到相信所有现代浏览器都支持CORS
(跨域资源共享)。
当我的玩具 JavaScript 工具不能在 IE9 或 Opera 上运行时,我发现前者只支持CORS
through XDomainRequest
,而 jQuery 似乎不支持。Opera 根本不支持CORS
。
现在 jQuery 有了一个抽象接口,可以执行正常的同域 AJAX 查询、CORS
查询,甚至JSONP
以相同的方式进行查询。
这个接口是否有一个扩展,可以进一步使它在不可用的情况下也能正常工作XDomainRequest
并回退到不可用的JSONP
时候?CORS
javascript - Sencha Touch 和 CORS 支持(不通过 JSOP)
我正在尝试对名为parse和 sencha touch 的经过身份验证的 api 进行 ajax 调用。我目前正在使用此 git 代码https://www.parse.com/docs/rest#queries-basic / 实施视频http://vimeo.com/28821052进行实施
尝试提出请求时出现此问题:
我试图像这样设置正确的标题,但没有骰子。
这里会出现什么问题?
php - 带有 PHP 标头的跨域请求标头 (CORS)
我有一个简单的 PHP 脚本,我正在尝试跨域 CORS 请求:
然而我仍然得到错误:
请求头字段
X-Requested-With
不允许Access-Control-Allow-Headers
有什么我想念的吗?
jquery - 浏览器和 AJAX 响应 CORS 标头不同
我正在尝试设置一个支持 CORS 的 API,我可以通过 JavaScript 访问它。
我用来测试的代码是这样的:
这是一个相当简单的 AJAX 请求。
我在我的 nginx 配置中启用了 CORS
在我的浏览器中访问 API 时,萤火虫会显示预期的标头
当我在 firebug 中查看 XHR 请求时,CORS 标头不存在:
使用时我确实收到了正确的标题curl
不用说,我很困惑为什么这不起作用,有什么想法吗?
jquery - CORS 请求 - 为什么不发送 cookie?
我有一个成功预飞行的跨域 AJAX GET,但 cookie 没有附加到 GET 请求。当用户单击登录按钮时,会进行 POST 以使用户登录,这可以跨域正常工作。JavaScript 是:
响应标头包括一个 cookie:
如果登录成功,将发出 JavaScript GET 请求以获取当前用户的详细信息:
Chrome 的 OPTIONS 请求返回的与 CORS 相关的标头是:
但是,不会在 GET 请求上发送任何 cookie。