tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

iframe-focus-event-after-iframe-gets-focus-inner.html (564B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Iframe focus event inner document</title>
      6 </head>
      7 <body>
      8 <h1>Inner</h1>
      9 <script>
     10 let innerlog = "innerlog:";
     11 
     12 window.onmessage = function(e) {
     13  if (e.data == "windowfocus") {
     14    innerlog += "willfocuswindow,";
     15    window.focus();
     16    innerlog += "didfocuswindow,";
     17  } else if (e.data == "getlog") {
     18    parent.postMessage(innerlog, "*");
     19  }
     20 };
     21 
     22 window.onfocus = function() {
     23  innerlog += "windowfocus,";
     24 };
     25 
     26 window.onblur = function() {
     27  innerlog += "windowblur,";
     28 };
     29 </script>
     30 </body>
     31 </html>