简体   繁体   English

在模式而不是新窗口中打开目标空白

[英]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.

相关问题 target =“ _ blank”弹出一个窗口,而不是打开一个新选项卡 - target=“_blank” pop-ups a window instead of open a new tab target =“ _ blank”不会打开新窗口 - target=“_blank” does not open new window 在新选项卡中打开而不是新的_blank窗口 - Open in new tab instead of new _blank window 使用目标“ _blank”打开window.open打开一个新的浏览器窗口 - window.open with target '_blank' opens a new browser window Google Analytics 中点击跟踪的目标空白(在新窗口中打开) - Target blank (open in new window) for click track in Google Analytics 目标 _blank 不会在新选项卡/窗口中打开 - Target _blank doesn't open in new tab/window 具有`target =“_ blank”`的沙盒iFrame不会打开新选项卡或窗口 - Sandboxed iFrame with `target=“_blank”` doesn't open new tab or window 以模式而不是新标签页或新窗口打开外部链接 - open external links in modal instead of new tab or new window 使用 target="_blank"/window.open() 打开新窗口/选项卡时如何防止 sessionStorage 被继承? - How to prevent sessionStorage being inherited when using target="_blank"/window.open() to open a new window/tab? Window.open + href替换并弹出到新窗口,但不使用target _blank - Window.open + href replace and pop into new window but not using target _blank
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM