tor-browser

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

focus-event-after-same-site-iframe-gets-focus-outer.html (784B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Focus event after same site iframe gets focus outer</title>
      4 <iframe src="focus-event-after-iframe-gets-focus-inner.html"></iframe>
      5 <script>
      6 let outerlog = "outerlog:";
      7 
      8 let iframe = document.querySelector("iframe");
      9 window.onmessage = function(e) {
     10  if (e.data == "start") {
     11    window.onfocus = function() {
     12      outerlog += "windowfocus,";
     13    };
     14  } else if (e.data == "focus") {
     15    iframe.contentWindow.postMessage("focus", "*");
     16  } else if (e.data == "getlog") {
     17    iframe.contentWindow.postMessage("getlog", "*");
     18  } else {
     19    opener.postMessage(outerlog + e.data, "*");
     20  }
     21 };
     22 
     23 window.onload = function() {
     24  window.onblur = function() {
     25    outerlog += "windowblur,";
     26  };
     27 
     28  opener.postMessage("ready", "*");
     29 };
     30 </script>