JSFiddle - React, Tailwind, and code Playground
by Nakul Kundra
HTML
<a id="add" href="#">Add Tab</a>
<a id="remove" href="#">Remove</a>
<br />
<div id="iframeContainer">
<iframe src="www.google.co.in" width="300" height="400" />
</div>
JavaScript
$('iframe')[0].contentWindow.onbeforeunload = function(){
console.log("unloading iframe");
console.log(this);
console.log($(document));
$(document).unbind().die();
$(document).find('*').unbind().die();
console.log("unloading iframe completed");
}
$('#remove').click(function(){
console.log("click");
$('iframe')[0].contentWindow.location.reload();
setTimeout(function(){
$('iframe').remove();
}, 1000);
});
$('#add').click(function(){
console.log("addclick");
});