Why do I get a different file when Saving the "View Source" page in Chrome compared to what I see?

0

If you press Ctrl+U in Chrome, this will open up the Page Source. If you copy and paste this into Notepad and save it, then go back to Chrome and press Ctrl+S to save the page.

The page generated Ctrl+S is significantly larger:

enter image description here

Why are the files different? I would expect Ctrl+S would just save the HTML I see on my screen; the same HTML I get when I copy and paste it into Notepad.

I need to get the HTML from some forum posts and I've been manually going through and saving the HTML one thread at a time, but I just found I need to save about 6x as many as I've done already. This is very tedious, I'd be great if I could at least utilize Ctrl+S or some sort of browser plugin to automatically save the HTML that I would get as if I manually did View Source -> Select All -> Copy -> Paste into Notepad -> Save.

sab669

Posted 2017-01-31T16:47:20.160

Reputation: 779

2when javascript executes in the page, it may draw in additional code and markup from remote sources. This code/content is only present if the page is rendered, so a simple source view of the page only contains a portion of the runtime content. – Frank Thomas – 2017-01-31T16:50:29.237

2Or the reverse of what @FrankThomas suggests, the "Saved" version contains all the code needed for the page, where as the "Copied" version is (probably) smaller because JavaScript removed/hid lots of elements from that specific view of the page. – Ƭᴇcʜιᴇ007 – 2017-01-31T17:08:29.413

No answers