tor-browser

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

pus-initiator-page-template.html (1109B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Initiator page</title>
      5 </head>
      6 <body>
      7 <script src="/speculation-rules/prerender/resources/utils.js"></script>
      8 <script type="speculationrules">
      9 {
     10  "prerender_until_script": [
     11    {
     12      "urls": ["{{prerendering_url}}"]
     13    }
     14  ]
     15 }
     16 </script>
     17 <script>
     18  const params = new URLSearchParams(location.search);
     19  const uid = params.get('uid');
     20 
     21  const signal_url = `{{signal_url}}`;
     22  const prerendering_url = `{{prerendering_url}}`;
     23 
     24  fetch(signal_url).then(response => {
     25    // The fetch promise will be resolved after the prerendering page is ready
     26    // for activation. The server will hold the response to signal_url until it
     27    // receives a signal from the prerendering page to confirm it is ready for
     28    // activation.
     29    if (response.status == 200){
     30      window.location = prerendering_url.toString();
     31    } else {
     32    const testChannel = new PrerenderChannel('test-channel');
     33    testChannel.postMessage(
     34        `Failed to navigate the prerendered page: ${e.toString()}`);
     35    testChannel.close();
     36    window.close();
     37    }
     38  });
     39 </script>
     40 42
     41 </body>
     42 </html>