Initial Query

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?

LLM Generation

Query

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?

Output

To get a copy of the entire HTML of the currently loaded page in Chrome's console (even if the page is no longer available but still present in the DOM), follow these steps: 1. **Open the Chrome DevTools Console**: Press `F12` or `Ctrl+Shift+J` (Windows/Linux) / `Cmd+Option+J` (Mac). 2. **Run this JavaScript command**:

1
2
   copy(document.documentElement.outerHTML);
   
This copies the full HTML to your clipboard. You can now paste it anywhere (e.g., a text editor). If `copy()` doesn’t work (e.g., in some restricted contexts), use:
1
2
   console.log(document.documentElement.outerHTML);
   
Then right-click the logged HTML in the console and select **Copy** or save it manually. --- ### Important Notes: - This works **only if the page’s HTML is still loaded in the DOM** (e.g., a server-generated 404 page or cached content). - If Chrome shows a browser-level error page (e.g., "This site can’t be reached"), this method **won’t work** because the original page’s HTML is no longer accessible.

Substring Evaluation

Testing if the previous output contains the string outerHTML: True