How to block pop-up, banner ads and video ads in iframe?

后端 未结 2 2111
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 07:48

I\'m embedding video that has an exit pop-up banner ads and video ads. When you anywhere in video then popups open automatic or how to click on X icon to close

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 08:00

    You can add sandbox attribute in your iframe. Only the values you add to the attribute will be allowed. Any value you do not add in the sandbox attribute will not be allowed by browser.

    Sandbox attribute has following values:

    allow-forms
    allow-pointer-lock
    allow-popups
    allow-same-origin
    allow-scripts
    allow-top-navigation
    

    I have modified your code to include sandbox option, but have NOT added allow-popups, so popups will not be allowed in this iframe.

    You can find more about sandbox attribute here. Please note that this attribute is new in HTML5.

提交回复
热议问题