同源的主机,JS中的不同端口 [英] Same origin host, different ports in JS

查看:117
本文介绍了同源的主机,JS中的不同端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于两个主机

  http://1.com.local/ 
http:// 2 .com.local:8080 /

如何使用 document.domain 启用DOM之间的操纵?如果我将两者都设置为 com.local ,它不起作用,因为第二个主机然后获取域 com.local:8080

当我尝试将第一个域的域设置为 com.local:8080 手动,端口只是被截断,域名保持 com.local



如何启用DOM操作在这种情况下?

解决方案

你不能。对不起 - 相同的来源包括端口



您可以使用 CORS 和ajax将一些东西从一个服务器复制到另一个服务器您启用此功能。


for the two hosts

http://1.com.local/
http://2.com.local:8080/

how can I use document.domain to enable DOM-Manipulation between the two? If i set both to com.local it doesn't work, because the 2nd host then gets the domain com.local:8080.

When I try to set the domain of the first one to com.local:8080 manually, the port is just snipped of and the domain remains com.local.

How can I enable DOM-Manipulation in this situation?

解决方案

You cannot. Sorry - same origin is including the ports

You can use CORS and ajax to copy some stuff from one server to the other if you enable this.

这篇关于同源的主机,JS中的不同端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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