跨域请求阻止:同源策略不允许读取远程资源时 [英] Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at

查看:473
本文介绍了跨域请求阻止:同源策略不允许读取远程资源时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站使用 CometChat 最近我的用户技术具有此问题与接收消息。在萤火虫的检查后,我意识到这一定是因为CORS保护(因以下错误)脚本失败。

I'm using CometChat in my website and recently my users art having this problem with receiving messages. After inspection in FireBug i realized it must be because of the CORS protection (due to the following error) that the script is failing.

跨域请求阻止:同源策略不允许的阅读   在远程资源    http://x3.chatforyoursite.com/subscribe/ ...   这可以固定通过移动资源到相同域或   启用CORS。

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://x3.chatforyoursite.com/subscribe/... This can be fixed by moving the resource to the same domain or enabling CORS.

现在我想知道,我应该能够CORS,因为这是我自己的服务器上启用了,我要在 CometChat 服务器的访问权限。

Now I'm wondering where should I enable CORS because it is enabled on my own server and I have no access to the CometChat server.

推荐答案

x3.chatforyoursite.com 服务器需要输出下面的头:

The server at x3.chatforyoursite.com needs to output the following header:

访问控制 - 允许 - 产地:http://www.example.com

其中, http://www.example.com 为你的网站地址。你应该检查 chatforyoursite.com 您的设置,看你是否能实现这一点 - 如果不是他们的技术支持很可能是解决这一问题的最佳途径。然而,为了回答你的问题,你需要远程站点,让您的网站访问AJAX响应客户端。

Where http://www.example.com is your website address. You should check your settings on chatforyoursite.com to see if you can enable this - if not their technical support would probably be the best way to resolve this. However to answer your question, you need the remote site to allow your site to access AJAX responses client side.

这篇关于跨域请求阻止:同源策略不允许读取远程资源时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆