[英]Open target blank in modal instead of new window
I'm trying to find a way in javascript to open all external links (or better: all links that normally open in a new window/tab) in a modal box instead. 我正在尝试在javascript中找到一种方法来在模式框中打开所有外部链接(或更好的方法:通常在新窗口/标签中打开的所有链接)。
Essentially I'm looking for a way to attach a listener to external links (that are not targeting the same window) and open them to my modal box instead of opening a new window. 本质上,我正在寻找一种将侦听器附加到外部链接(不针对同一窗口)并将其打开到我的模式框中而不是打开新窗口的方法。
Most ideally it shouldn't matter if a popup is generated by a _blank anchor or by javascript/any other way. 最理想的情况是,弹出窗口是由_blank锚还是由javascript /其他任何方式生成都没有关系。
Trying to accomplish this in vanilla javascript. 尝试在香草javascript中完成此操作。
Thank you so much for your help! 非常感谢你的帮助!
Most of this seems to be like your question: 其中大多数似乎像您的问题:
Opening an external website in a modal popup 在模式弹出窗口中打开外部网站
The iframe element inside a modal can read the external site, and you could change the src attribute dinamically. 模态中的iframe元素可以读取外部网站,并且您可以动态更改src属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.