I have a webpage that's open in a chrome browser but the page no longer exists. What javascript should I type in the console to get a copy of the entire page html?
I have a webpage that's open in a chrome browser but the page no longer exists. What javascript should I type in the console to get a copy of the entire page html?
You can grab the entire HTML of the loaded page by running this JavaScript snippet in the Chrome DevTools console: -------------------------------------------------- copy(document.documentElement.outerHTML); -------------------------------------------------- Here’s what happens: • document.documentElement.outerHTML retrieves the HTML for the entire document. • The copy() function (available in Chrome’s console) copies that string to your clipboard. After you run this command, simply paste (Ctrl+V or Cmd+V) the HTML wherever you need it.
Testing if the previous output contains the string outerHTML
: True
I have a webpage that's open in a chrome browser but the page no longer exists. What javascript should I type in the console to get a copy of the entire page html?
I have a webpage that's open in a chrome browser but the page no longer exists. What javascript should I type in the console to get a copy of the entire page html?
You can use the following command in your Chrome console to copy the entire HTML into your clipboard: copy(document.documentElement.outerHTML) Here’s how to do it: 1. Open Chrome’s Developer Tools (for example, by pressing F12 or Ctrl+Shift+I on Windows/Linux or Cmd+Option+I on macOS). 2. Go to the Console tab. 3. Paste the command above and press Enter. This command retrieves the outer HTML of the document (i.e., the full HTML of the page) and copies it to your clipboard. You can then paste it into a text file or wherever you need it.
Testing if the previous output contains the string outerHTML
: True