1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21

content / test / data / remove_frame_on_unload.html [blame]

<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>