ajax 同一台服务器上的不同端口是否被视为跨域?(阿贾克斯明智的)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1077218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Are different ports on the same server considered cross-domain? (Ajax-wise)
提问by Sean Kinsey
Can XMLHttpRequest send a request to http:// mydomain.com:81/ from http:// mydomain.com/ ?
XMLHttpRequest 可以从 http://mydomain.com/ 向 http://mydomain.com:81/ 发送请求吗?
回答by Sean Kinsey
For two documents to be considered to have the same origin, the protocol (http/https), the domain and the port (the default 80 or :xx) have to be indentical. So no, you cannot use xhr against a different port.
对于被认为具有相同来源的两个文档,协议 (http/https)、域和端口(默认为 80 或 :xx)必须相同。所以不,你不能对不同的端口使用 xhr。

