tor-browser

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

grand-child-autofocus.html (519B)


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