JSFiddle - React, Tailwind, and code Playground

by mrobin

HTML

<a href="#">Remove</a>
<br />
<iframe src="http://google.co.in" width="300" height="400" />

JavaScript

$('iframe')[0].contentWindow.onbeforeunload = function(){
    console.log("unloading iframe");
    console.log(this);
}
$('a').click(function(){
    $('iframe')[0].contentWindow.location.reload();
    setTimeout(function(){
       $('iframe').remove();
    }, 1000);
});