How to block pop-up coming from iframe?

前端 未结 7 2054
独厮守ぢ
独厮守ぢ 2020-11-29 09:34

I\'m embedding page that has an exit pop-up. When you close the page, it automatically launches a pop-up window.

How to disable pop-ups coming from the ifram

相关标签:
7条回答
  • 2020-11-29 10:03

    Quite an old ask, but I thought I'd offer a newer solution since this is the top result in google.

    If you want to block an iframe from opening windows, you can use the new HTML5 "sandbox" attribute on your iframe.

    https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe

    This should keep it from doing anything (except running javascript which may be required for the page to function correctly):

    <iframe sandbox="allow-scripts" src="your/url/here"></iframe>
    
    0 讨论(0)
提交回复
热议问题