tor-browser

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

file_useractivation_sandbox_transient_popup.html (748B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>User activation popup</title>
      5 </head>
      6 <body>
      7 <iframe sandbox="allow-top-navigation-by-user-activation allow-scripts allow-same-origin"></iframe>
      8 <script>
      9  window.addEventListener("message", (e) => {
     10    if (e.data === "triggerIframeLoad") {
     11      // Load into the the iframe a script which notifies the opener of top level navigation or if it was prevented. 
     12      let script = `window.opener.postMessage("topNavigation");`;
     13      frames[0].frameElement.src = `javascript:try{window.top.location='javascript:${encodeURIComponent(script)}';} catch (e) {window.top.opener.postMessage("topNavigationBlocked");}`;
     14    } else {
     15      window.opener.postMessage("unexpected");
     16    }
     17  });
     18 </script>
     19 </body>
     20 </html>