tor-browser

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

refresh_meta.sjs (1082B)


      1 /**
      2  * Will cause an auto-refresh to the URL provided in the query string
      3  * after some delay using a <meta> tag.
      4  *
      5  * Expects the query string to be in the format:
      6  *
      7  * ?p=[URL of the page to redirect to]&d=[delay]
      8  *
      9  * Example:
     10  *
     11  * ?p=http%3A%2F%2Fexample.org%2Fbrowser%2Fbrowser%2Fbase%2Fcontent%2Ftest%2Fgeneral%2Frefresh_meta.sjs&d=200
     12  */
     13 function handleRequest(request, response) {
     14   let query = new URLSearchParams(request.queryString);
     15 
     16   let page = query.get("p");
     17   let delay = query.get("d");
     18 
     19   let html = `<!DOCTYPE HTML>
     20               <html>
     21               <head>
     22               <meta charset='utf-8'>
     23               <META http-equiv='refresh' content='${delay}; url=${page}'>
     24               <title>Gonna refresh you, folks.</title>
     25               </head>
     26               <body>
     27               <h1>Wait for it...</h1>
     28               </body>
     29               </html>`;
     30 
     31   response.setHeader("Content-Type", "text/html", false);
     32   response.setStatusLine(request.httpVersion, "200", "Found");
     33   response.setHeader("Cache-Control", "no-cache", false);
     34   response.write(html);
     35 }