带有返回值的跨域弹出窗口 [英] Cross domain popup window with return value
问题描述
这是设置:
我在两个不同的域上有两个网站:
I have two websites on two different domains:
-
www.website1.com
-
www.someotherwebsite。 com
www.website1.com
www.someotherwebsite.com
这是我想做的:
This is what I want to do:
-
当用户在
www.website1.com
上并点击链接时,想要一个窗口弹出显示www.someotherwebsite.com
。
When a user is on
www.website1.com
and clicks a link, I want a window to popup showingwww.someotherwebsite.com
.
弹出窗口(显示 www.someotherwebsite.com
)我想要该窗口关闭并返回一个值。
When the user clicks a button in the popup window (showing www.someotherwebsite.com
) I want that window to close and have a value returned.
我希望从弹出式窗口返回的值放在<$ c $(在div中,或在javascript调用,或可访问的地方,如填写表单字段) c> www.website1.com
I want the value returned from the popup window to be placed (into a div, or into a javascript call, or someplace accessible such as filling out a form field) on www.website1.com
.
我希望这样做有意义。我需要使用只是HTML和Javascript没有外部库。它还必须在当前的主流浏览器上工作(即不是HTML5的东西)。
I hope that makes sense. I need to use just HTML and Javascript without external libraries. It also must work on current mainstream browsers (i.e. not be an HTML5 thing).
先感谢您的帮助。
推荐答案
好吧,如果你在弹出窗口中使用iframe [在这个时代,我会避免弹出窗口像瘟疫由于弹出窗口拦截器]
Well if you use an iframe in your pop up window [in this day in age I would avoid pop up windows like the plague due to pop up blockers]
使用iframe,您可以跨域调用
With an iframe you can make cross domain calls
为什么你不是从A到B开发一个Web服务并从A调用它?看起来比在浏览器中找到小裂缝更清洁,以获得安全。
Why don't you just develop a webservice from A to B and call it from A? Seems so much cleaner than finding small cracks in browsers to get around security.
这篇关于带有返回值的跨域弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!