tor-browser

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

download_test.html (1512B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Download test</title>
      5    <style>
      6      html {
      7        font-family: neo-sans;
      8        font-weight: 700;
      9        font-size: calc(42rem / 16);
     10      }
     11      body {
     12        background: white;
     13      }
     14      section {
     15        border-radius: 1em;
     16        padding: 1em;
     17        position: absolute;
     18        top: 50%;
     19        left: 50%;
     20        margin-right: -50%;
     21        transform: translate(-50%, -50%);
     22      }
     23    </style>
     24  </head>
     25  <body>
     26    <section>Download test</section>
     27    <button id="downloadBtn">Download Test</button>
     28    <p id="download_status"></p>
     29    <script>
     30      let download_status = "";
     31 
     32      function set_status(status) {
     33        download_status = status;
     34        console.log("download_status:" + status);
     35        document.getElementById("download_status").textContent = status;
     36      }
     37 
     38      set_status("not_started");
     39 
     40      const handleDownloadTest = () => {
     41        set_status("started");
     42        const startTime = performance.now();
     43        fetch("/upload-test-32MB.dat")
     44          .then((response) => response.blob())
     45          .then((_) => {
     46            const endTime = performance.now();
     47            const downloadTime = endTime - startTime;
     48            set_status("success time:" + downloadTime);
     49          })
     50          .catch((error) => {
     51            console.error(error);
     52          });
     53      };
     54      document
     55        .querySelector("#downloadBtn")
     56        .addEventListener("click", handleDownloadTest);
     57    </script>
     58  </body>
     59 </html>