Cross domain popup window with return value(带返回值的跨域弹窗)
问题描述
这是设置:
我在两个不同的域上有两个网站:
www.website1.com
www.someotherwebsite.com
这就是我想做的:
当用户在
www.website1.com
上并单击链接时,我希望弹出一个显示www.someotherwebsite.com
的窗口..p>当用户单击弹出窗口中的按钮(显示
www.someotherwebsite.com
)时,我希望该窗口关闭并返回一个值.我希望将弹出窗口返回的值放在
www.website1.com代码>.
我希望这是有道理的.我只需要使用没有外部库的 HTML 和 Javascript.它还必须适用于当前的主流浏览器(即不是 HTML5 的东西).
提前感谢您的帮助.
好吧,如果你在弹出窗口中使用 iframe [在这个时代,我会避免像瘟疫那样弹出窗口,因为弹出窗口阻止程序]
使用 iframe,您可以进行 跨域调用
你为什么不开发一个从 A 到 B 的 web 服务并从 A 调用它?似乎比在浏览器中发现小裂缝来绕过安全性要干净得多.
This is the setup:
I have two websites on two different domains:
www.website1.com
www.someotherwebsite.com
This is what I want to do:
When a user is on
www.website1.com
and clicks a link, I want a window to popup showingwww.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.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
.
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).
Thank you in advance for your help.
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]
With an iframe you can make cross domain calls
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.
这篇关于带返回值的跨域弹窗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:带返回值的跨域弹窗


基础教程推荐
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01