tor-browser

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

activeelement-after-focusing-different-site-iframe-then-immediately-focusing-back-outer.sub.html (1133B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>activeElement when focusing different-site iframe then immediately focusing back outer</title>
      4 <input type="text">
      5 <iframe src="http://{{hosts[alt][www]}}:{{ports[http][0]}}/focus/support/focus-event-after-focusing-iframes-inner.html"></iframe>
      6 <script>
      7 let outerlog = "outerlog:";
      8 
      9 let iframe = document.querySelector("iframe");
     10 let input = document.querySelector("input");
     11 window.onmessage = function(e) {
     12  if (e.data == "focus") {
     13    outerlog += "willfocusiframe,";
     14    iframe.focus();
     15    outerlog += "didfocusiframe,";
     16    outerlog += "willfocusinput,";
     17    input.focus();
     18    outerlog += "didfocusinput,";
     19  } else if (e.data == "getlog") {
     20    iframe.contentWindow.postMessage("getlog", "*");
     21  } else if (e.data == "getActiveElement") {
     22    opener.postMessage(document.activeElement.tagName, "*");
     23  } else {
     24    opener.postMessage(outerlog + e.data, "*");
     25  }
     26 };
     27 
     28 window.onload = function() {
     29  input.onfocus = function() {
     30    outerlog += "inputfocus,";
     31  };
     32 
     33  input.onblur = function() {
     34    outerlog += "inputblur,";
     35  };
     36 
     37  opener.postMessage("ready", "*");
     38 };
     39 </script>