tor-browser

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

delegate-fullscreen-request-recipient.html (864B)


      1 <!DOCTYPE html>
      2 <title>Capability Delegation of Fullscreen Requests test recipient</title>
      3 <body>Capability Delegation of Fullscreen Requests test recipient body</body>
      4 
      5 <script>
      6  const initiator = window.opener ? window.opener : window.top;
      7  initiator.postMessage({"type": "recipient-loaded"}, "*");
      8 
      9  function reportResult(msg) {
     10      initiator.postMessage({"type": "result", "result": msg}, "*");
     11  }
     12 
     13  document.addEventListener('fullscreenchange', async () => {
     14      if (document.fullscreenElement) {
     15          await document.exitFullscreen();
     16          reportResult("success");
     17      }
     18  });
     19 
     20  document.addEventListener('fullscreenerror', () => {
     21      reportResult("failure");
     22  });
     23 
     24  window.addEventListener("message", e => {
     25      if (e.data.type == "make-fullscreen-request") {
     26          document.body.requestFullscreen();
     27      }
     28  });
     29 </script>