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
I used sandbox
function in this code on my Streaming Site where i Embed
3rd Party iframe
and they also have sandbox
protection check but for that iv'e added removeAttribute
in my JS
so if you change src
of the iframe
from some other button
you can click this button to add sandbox
attribute to your iframe
or you can also add the click function
in your code where you get your iframe successfully.
//JS
window.onload = function(){
var button = document.getElementsByName("sandbox")[0]
var iframe = document.getElementsByName("framez")[0]
button.addEventListener('click',sndbx,false);
function sndbx(){
var nibba = document.getElementById("framez").src;
if(iframe.sandbox == 'allow-forms allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation'){
document.getElementById("framez").removeAttribute("sandbox");
}
frames['framez'].location.href=nibba;
iframe.sandbox = 'allow-forms allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation';
}
}