Is it possible to force a pop up to open in an iframe where the action to open the pop up has taken place?
I have a VueJs Application that displays a website inside an iframe and don't want the application to open new windows. But it is also not acceptable to just block all the popups with sand boxing, as some contain critical functionality.
Thus i am looking for any way to "force" target="_blank"
onto the link on the webpage.
I know that there is no standard way to do so, but would be open for any suggestion on how to alternatively solve this.
Maybe there is a way to disable the browsers ability to open new windows and hijack the calls.
Looking forward to your answers.
Is it possible to force a pop up to open in an iframe where the action to open the pop up has taken place?
I have a VueJs Application that displays a website inside an iframe and don't want the application to open new windows. But it is also not acceptable to just block all the popups with sand boxing, as some contain critical functionality.
Thus i am looking for any way to "force" target="_blank"
onto the link on the webpage.
I know that there is no standard way to do so, but would be open for any suggestion on how to alternatively solve this.
Maybe there is a way to disable the browsers ability to open new windows and hijack the calls.
Looking forward to your answers.
Share Improve this question edited Nov 10, 2020 at 8:43 Tobias Famos asked Nov 10, 2020 at 7:44 Tobias FamosTobias Famos 3121 gold badge3 silver badges12 bronze badges1 Answer
Reset to default 4That capability is all or nothing, mostly. Since it's a different site in the iframe
, you likely don't have access to the iframe
content and so can't control the links in it.
iframe
has a sandbox
attribute to which you could add the allow-popups
option
allow-popups
: Allows popups (such aswindow.open()
,target="_blank"
, orshowModalDialog()
). If this keyword is not used, the popup will silently fail to open.
As in:
<iframe ... sandbox="allow-popups"></iframe>
There's also:
allow-popups-to-escape-sandbox
: Lets the sandboxed document open new windows without those windows inheriting the sandboxing. For example, this can safely sandbox an advertisement without forcing the same restrictions upon the page the ad links to.allow-modals
: Lets the resource open modal windows.