file_link_dns_prefetch.sjs (657B)
1 "use strict"; 2 3 function handleRequest(request, response) { 4 // write to raw socket 5 response.seizePower(); 6 let body = `<!DOCTYPE html> 7 <html> 8 <head> 9 <link rel="dns-prefetch" href="https://example.org"> 10 </head> 11 <body> 12 <h1>Test rel=dns-prefetch<h1> 13 <a href="https://www.mozilla.org"> Test link </a> 14 </body> 15 </html>`; 16 17 response.write("HTTP/1.1 200 OK\r\n"); 18 response.write("Content-Type: text/html;charset=utf-8\r\n"); 19 response.write("Cache-Control: no-cache\r\n"); 20 response.write(`Content-Length: ${body.length}\r\n`); 21 response.write("\r\n"); 22 response.write(body); 23 24 response.finish(); 25 }