tor-browser

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

xhr-iframe.html (495B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>iframe for xhr tests</title>
      4 <script>
      5 async function xhr(url, options) {
      6  return new Promise((resolve, reject) => {
      7    const xhr = new XMLHttpRequest();
      8    const opts = options ? options : {};
      9    xhr.onload = () => {
     10      resolve(xhr);
     11    };
     12    xhr.onerror = () => {
     13      reject('xhr failed');
     14    };
     15 
     16    xhr.open('GET', url);
     17    if (opts.responseType) {
     18      xhr.responseType = opts.responseType;
     19    }
     20    xhr.send();
     21  });
     22 }
     23 </script>