How to block pop-up coming from iframe?

前端 未结 7 2187
独厮守ぢ
独厮守ぢ 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 09:53

    I don't think this is possible.

    • first (and most importantly), if the iframe is in a different domain, you can't change its DOM - such as the onunload handlers. If this is the case, the other two issues are moot.
    • second, even if you could, you'd have to remove the listener in some way. If the listener is loaded via window.onunload, that would be simple; otherwise, not so much.
    • third, in the long term this would lead to the same arms race as the frame-busting-busters

    The only possibility I see is non-technical in nature: check with whoever runs that site inside the iframe if they could make a special page for you, one without such onunload popup. In most cases, either

    • a) some special arrangement can be made (although not always for free), or
    • b) removing the functionality would be a violation of the ToS, in which case you'd have to look for someone else providing similar functionality, without the pop-ups (and realistically, most services have more than a single provider)

提交回复
热议问题