<html> | |
<head> | |
<title>Remove Frame on Unload</title> | |
<script> | |
function openWindow() { | |
var w = window.open("title1.html"); | |
return true; | |
} | |
window.addEventListener('unload', function() { | |
var f = document.getElementById("f"); | |
document.body.removeChild(f); | |
}, false); | |
</script> | |
</head> | |
<body> | |
<button onclick="openWindow()">Open Window</button> | |
<p>Navigate to another page to cause frame to be removed.</p> | |
<iframe id="f" src="about:blank"></iframe> | |
</body> | |
</html> |