Same origin host, different ports in JS

烂漫一生 提交于 2019-11-27 06:42:56

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5714135/same-origin-host-different-ports-in-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!