0

I would like to take a complete snapshot of website using JavaScript, like the one a browser take when saving the page as HTML (picture below).

enter image description here

By using a simple script like document.documentElement.innerHTML, the HTML part of a website can be obtained. However, it does not contain the linked style sheets.

To achieve this, I guess I have to get all resources the website loads. Is it possible?

nakaakist
  • 308
  • 4
  • 15
  • 1
    yes, you're right ... the linked stylesheets need to be retrieved separately ... also any other external resources, like images, and scripts, url's in the stylesheets, imports in the stylesheets, etc – Jaromanda X Aug 01 '22 at 08:14
  • Thanks. [XMLSerializer](https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer) is exactly what I want. (I saw this question before, but I missed the the right answer because it was not at the top...) – nakaakist Aug 01 '22 at 10:39

0 Answers0