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 JavaScript code in the Chrome browser's console to get the entire page's HTML:
1 | document.documentElement.outerHTML |
1 | copy(document.documentElement.outerHTML) |
1 | console.log(document.documentElement.outerHTML) |
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?
Here's a JavaScript snippet you can paste into the Chrome DevTools console to get the full HTML of the current page:
1 | console.log(document.documentElement.outerHTML); |
1 | copy(document.documentElement.outerHTML); |
1 2 3 4 5 6 7 8 9 10 | (function() { var html = document.documentElement.outerHTML; var blob = new Blob([html], {type: 'text/html'}); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = 'webpage.html'; a.click(); URL.revokeObjectURL(url); })(); |
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?
To get the entire HTML of the current page in Chrome's console, you can use this JavaScript command:
1 | document.documentElement.outerHTML |
1 | document.documentElement.innerHTML |
1 | copy(document.documentElement.outerHTML) |
1 2 3 4 5 6 | var blob = new Blob([document.documentElement.outerHTML], {type: 'text/html'}); var url = URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; a.download = 'webpage.html'; a.click(); |
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 JavaScript code in the Chrome browser's developer console to get the entire page's HTML:
1 | document.documentElement.outerHTML |
1 | copy(document.documentElement.outerHTML) |
1 | console.log(document.documentElement.outerHTML) |
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?
Here's a JavaScript command you can use in the Chrome browser's console to get the entire page HTML:
1 | console.log(document.documentElement.outerHTML); |
1 | navigator.clipboard.writeText(document.documentElement.outerHTML); |
1 2 3 4 5 6 7 8 | const html = document.documentElement.outerHTML; const blob = new Blob([html], {type: 'text/html'}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'page.html'; a.click(); URL.revokeObjectURL(url); |
Testing if the previous output contains the string outerHTML
: True