lan-intrusion.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>LAN intrusion</title>
  6. </head>
  7. <body>
  8. <script>
  9. function requestPage(url, handler) {
  10. let request = new XMLHttpRequest();
  11. request.addEventListener("readystatechange", (event) => {
  12. console.debug("Request to", url, "has state", request.readyState, ".");
  13. if (request.readyState == 4 /* DONE */) {
  14. console.debug("Request to", url, "complete.");
  15. handler(request);
  16. }
  17. });
  18. request.open("GET", url, true);
  19. request.setRequestHeader( 'Access-Control-Allow-Origin', '*');
  20. request.send();
  21. }
  22. requestPage("http://172.20.0.81/", (request) => {
  23. if (request.status == 0 /* ERROR */) {
  24. console.log("Failed to request.");
  25. } else {
  26. console.log("Request successful.");
  27. }
  28. console.log("readyState: ", request.readyState);
  29. console.log("response: ", request.response);
  30. console.log("responseText: ", request.responseText);
  31. console.log("responseType: ", request.responseType);
  32. console.log("responseURL: ", request.responseURL);
  33. console.log("responseXML: ", request.responseXML);
  34. console.log("status: ", request.status);
  35. console.log("statusText: ", request.statusText);
  36. console.log("getAllResponseHeaders: ", request.getAllResponseHeaders());
  37. console.log("--------------");
  38. });
  39. </script>
  40. </body>
  41. </html>