Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
166 views
in Technique[技术] by (71.8m points)

javascript - Same origin host, different ports in JS

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...