tor-browser

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

focus-already-focused-iframe-inner.html (432B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Focus already focused iframe</title>
      4 <script>
      5 let haveGottenFocus = false;
      6 function gotFocus() {
      7    if (haveGottenFocus) {
      8        parent.postMessage("FAIL", "*");
      9    } else {
     10        haveGottenFocus = true;
     11        parent.postMessage("focus", "*");
     12    }
     13 }
     14 window.onload = function() {
     15    document.getElementsByTagName("input")[0].focus();
     16 }
     17 </script>
     18 <input onfocus="gotFocus();">