跨域错误

问题描述:

什么是跨域错误?

据了解,客户端工具(如Silverlight)也许Flash / Javascript)当您尝试连接到通常只允许在与该页面发送到同一个域的某个服务器(某些原始策略)时,会引发跨域错误。

As I understand it, client-side tools such as Silverlight (and maybe Flash/Javascript) throw a cross-domain error when you attempt to make a connection to a server that is normally only allowed when it is made to the same domain that the page was served from (some origin policy).

例如,当您尝试调用实时服务器或正在查看测试时,您正在查看测试服务器上的页面时,可能会引发跨域错误页面作为使用文件://协议的本地文件。

A cross-domain error may be thrown when, for example, you are viewing a page on your test server when it is trying to call your live server, or when you are viewing a test page as a local file using a file:// protocol.

请确保您正在测试的域与该网站设计的域名相同。请注意,Flash具有crossdomain.xml功能,特别允许您执行跨域请求。 Javascript也有方法绕过同一起源政策,但您应该了解您正在做的事情的含义。

Try ensuring that the domain you are testing on is the same as that which the site was designed to be on. Note that Flash has the crossdomain.xml feature which specifically allow you to do cross-domain requests. Javascript also has ways to get around same origin policy, but you should be aware of the implications of what you're doing.