tor-browser

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

child-autofocus.html (541B)


      1 <!DOCTYPE html>
      2 <input id="target" value="This should be unfocused!" autofocus></input>
      3 
      4 <script>
      5  let got_focus = false;
      6  document.getElementById("target").addEventListener("focus", () => {
      7    got_focus = true;
      8  });
      9 
     10  window.addEventListener("load", () => {
     11    parent.postMessage("child_loaded", "*");
     12  });
     13 
     14  window.addEventListener("message", event => {
     15    if (event.data == "report_focus_state") {
     16      let msg = got_focus ? "child_is_focused" : "child_is_not_focused";
     17      parent.postMessage(msg, "*");
     18    }
     19  });
     20 </script>