tor-browser

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

html_json-basic.html (1229B)


      1 <!-- Any copyright is dedicated to the Public Domain.
      2     http://creativecommons.org/publicdomain/zero/1.0/ -->
      3 <!doctype html>
      4 
      5 <html>
      6  <head>
      7    <meta charset="utf-8"/>
      8    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
      9    <meta http-equiv="Pragma" content="no-cache" />
     10    <meta http-equiv="Expires" content="0" />
     11    <title>Network Monitor test page</title>
     12  </head>
     13 
     14  <body>
     15    <p>JSON request test page</p>
     16    <p>Pass the JSON name (as supported by sjs_json-test-server.sjs) as a query parameter</p>
     17 
     18    <script type="text/javascript">
     19      /* exported performRequests */
     20      "use strict";
     21 
     22      function get(address) {
     23        return new Promise(resolve => {
     24          const xhr = new XMLHttpRequest();
     25          xhr.open("GET", address, true);
     26 
     27          xhr.onreadystatechange = function() {
     28            if (this.readyState == this.DONE) {
     29              resolve();
     30            }
     31          };
     32          xhr.send(null);
     33        });
     34      }
     35 
     36      async function performRequests() {
     37        // Forward the query parameter for this page to sjs_json-test-server
     38        await get("sjs_json-test-server.sjs" + window.location.search);
     39      }
     40    </script>
     41  </body>
     42 
     43 </html>