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 a copy of the entire HTML of the current page using the browser's console, you can use the following JavaScript:
1 | document.documentElement.outerHTML |
1 | copy(document.documentElement.outerHTML) |
1 2 3 4 5 6 7 8 | (function() { var htmlContent = document.documentElement.outerHTML; var blob = new Blob([htmlContent], {type: 'text/html'}); var a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'page.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?
To get a copy of the entire page HTML from a webpage that's currently open in your Chrome browser, you can use the following JavaScript in the console:
1 | document.documentElement.outerHTML |
1 2 | copy(document.documentElement.outerHTML); console.log('The entire HTML has been copied to your clipboard!'); |
1 2 3 4 5 6 7 | let htmlContent = document.documentElement.outerHTML; let blob = new Blob([htmlContent], {type: 'text/html'}); let link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = 'page_copy.html'; link.click(); URL.revokeObjectURL(link.href); |
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 a copy of the entire page HTML from a webpage that's open in your Chrome browser, even if the page no longer exists on the server, you can use the following JavaScript in the browser's console:
1 | document.documentElement.outerHTML |
1 | copy(document.documentElement.outerHTML); |
1 2 3 4 5 6 7 8 | (function() { var htmlContent = document.documentElement.outerHTML; var blob = new Blob([htmlContent], {type: 'text/html'}); var a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'page.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?
To get a copy of the entire page HTML from a webpage that's currently open in your Chrome browser, even if the original page no longer exists online, you can use the following JavaScript in the browser's console:
1 | document.documentElement.outerHTML |
1 | copy(document.documentElement.outerHTML); |
1 2 3 4 5 6 7 8 | (function() { var htmlContent = document.documentElement.outerHTML; var blob = new Blob([htmlContent], {type: 'text/html'}); var a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'page.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?
To get a copy of the entire HTML of the current page in Chrome's console, you can use one of these JavaScript commands: 1. The simplest method:
1 | document.documentElement.outerHTML |
1 | console.log(document.documentElement.outerHTML); |
1 | copy(document.documentElement.outerHTML); |
1 2 3 4 5 6 7 8 9 | (function(html) { var blob = new Blob([html], {type: 'text/html'}); var elem = window.document.createElement('a'); elem.href = window.URL.createObjectURL(blob); elem.download = 'page.html'; document.body.appendChild(elem); elem.click(); document.body.removeChild(elem); })(document.documentElement.outerHTML); |
Testing if the previous output contains the string outerHTML
: True