News for hackers. Stuff that matters.
Re:Ask HN: Why does 'View Source' issue a new HTTP request? by acqq on Monday December 19, 2016 @11:40AM (#13212606)
> requires keeping around the raw page HTML

Isn't it already in the browser's cache in that state anyway?

And if the cache is small, the preservation doesn't even have to be "for all tabs," if the last few pages can be retrieved from the cache nobody would complain that the older ones behave as they behave now -- you typically don't do "I wonder what was the source of the page from yesterday" in this old tab, but even if you do, you wouldn't be surprised that the source of yesterday does have to be requested again. So I imagine the fix as just "if in the cache, get it from there, else request."

Re:Ask HN: Why does 'View Source' issue a new HTTP request? by SerpentJoe on Monday December 19, 2016 @11:57AM (#13212798)
> Isn't it already in the browser's cache in that state anyway?

Like disk cache as in Cache-Control? In most cases you wouldn't cache the HTML itself, but in cases where you do then your use case should already work as stated, since for the browser to do otherwise would imply the cache is being intentionally ignored for the view-source request.

Re:Ask HN: Why does 'View Source' issue a new HTTP request? by acqq on Monday December 19, 2016 @02:13PM (#13214103)
> In most cases you wouldn't cache the HTML itself

Why not, at least as long as that's the topmost tab? Wouldn't then the view-source-new-request problem be solved by just using the existing features?