tor-browser

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

activeelement-after-calling-window-focus-inner.html (757B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Focus test inner document</title>
      6 </head>
      7 <body>
      8 <h1>Inner</h1>
      9 <input>
     10 <script>
     11 let innerlog = "innerlog:";
     12 
     13 window.onmessage = function(e) {
     14  if (e.data == "focusinnerinput") {
     15    document.querySelector("input").focus();
     16    innerlog += document.activeElement.tagName + ",";
     17  } else if (e.data == "focusinner") {
     18    window.focus();
     19    innerlog += document.activeElement.tagName + ",";
     20  } else if (e.data == "getlog") {
     21    parent.postMessage(innerlog, "*");
     22  }
     23 };
     24 
     25 window.onfocus = function() {
     26  innerlog += "windowfocus,";
     27 };
     28 
     29 window.onblur = function() {
     30  innerlog += "windowblur,";
     31 };
     32 
     33 window.onload = function() {
     34  parent.postMessage("ready", "*");
     35 }
     36 </script>
     37 </body>
     38 </html>