tor-browser

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

focus-restoration-in-different-site-iframes-outer.sub.html (1232B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Focus restoration outer</title>
      4 <script>
      5 let other = null;
      6 let log = "outerlog:";
      7 function getLog() {
      8    return log;
      9 }
     10 window.onmessage = function(e) {
     11    if (e.data == "start") {
     12        other = window.open("focus-restoration-in-different-site-iframes-other.html", "otherwindow", "resizable=yes");
     13    } else if (e.data == "other") {
     14        other.close();
     15        opener.step_timeout(function() {
     16            document.getElementsByTagName("iframe")[0].contentWindow.postMessage("getlog", "*");
     17        }, 2000);
     18    } else {
     19        opener.step_timeout(function() {
     20            opener.postMessage(getLog() + e.data, "*");
     21        }, 1500);
     22    }
     23 };
     24 window.onload = function() {
     25    document.getElementsByTagName("iframe")[0].onfocus = function() {
     26        log += "iframefocus,";
     27    }
     28    document.getElementsByTagName("iframe")[0].onblur = function() {
     29        log += "iframeblur,";
     30    }
     31    document.body.onfocus = function() {
     32        log += "bodyfocus,";
     33    }
     34    document.body.onblur = function() {
     35        log += "bodyblur,";
     36    }
     37 }
     38 </script>
     39 <iframe src="http://{{hosts[alt][www]}}:{{ports[http][0]}}/focus/support/focus-restoration-in-different-site-iframes-inner.html">