javascript - Is it possible to open a pop up in an iframe - Stack Overflow

Is it possible to force a pop up to open in an iframe where the action to open the pop up has taken pla

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 badges
Add a ment  | 

1 Answer 1

Reset to default 4

That 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 as window.open(), target="_blank", or showModalDialog()). 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744386294a4571680.html

相关推荐

  • javascript - Is it possible to open a pop up in an iframe - Stack Overflow

    Is it possible to force a pop up to open in an iframe where the action to open the pop up has taken pla

    7天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信