<story><title>Ask HN: Why does &apos;View Source&apos; issue a new HTTP request?</title><text>I&amp;#x27;ve noticed that both Firefox and Chrome issue a new HTTP request when you view the source for a web page that you&amp;#x27;ve already loaded. It&amp;#x27;s particularly annoying when the page itself is slow to load or if it won&amp;#x27;t load at all.&lt;p&gt;Why is that? Wouldn&amp;#x27;t they have the existing source for the originally received page cached already? Is it based on Cache-Control headers?&lt;p&gt;This has been on my mind for a while (usually comes up when looking at what&amp;#x27;s behind slow web apps) and came up again with Piwik on the front page[1]. Their website was semi-down (HN hug of death) but eventually loaded. I wanted to see what their GA equivalent tracking code looks like but the page failed to load as rather than showing the cached copy, it tried to fetch a new one.&lt;p&gt;[1]: https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=13210195</text></story><parent_chain></parent_chain><comment><author>spookylukey</author><text>It&amp;#x27;s a bug: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;bugzilla.mozilla.org&amp;#x2F;show_bug.cgi?id=307089&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;bugzilla.mozilla.org&amp;#x2F;show_bug.cgi?id=307089&lt;/a&gt;&lt;p&gt;Or, it&amp;#x27;s a memory saving feature. To implement &amp;quot;View source from cache&amp;quot; requires keeping around the raw page HTML, which you might not otherwise need after parsing - except you probably will for all the developer tools to work, so this  probably should just be considered bug.</text></comment>
<story><title>Ask HN: Why does &apos;View Source&apos; issue a new HTTP request?</title><text>I&amp;#x27;ve noticed that both Firefox and Chrome issue a new HTTP request when you view the source for a web page that you&amp;#x27;ve already loaded. It&amp;#x27;s particularly annoying when the page itself is slow to load or if it won&amp;#x27;t load at all.&lt;p&gt;Why is that? Wouldn&amp;#x27;t they have the existing source for the originally received page cached already? Is it based on Cache-Control headers?&lt;p&gt;This has been on my mind for a while (usually comes up when looking at what&amp;#x27;s behind slow web apps) and came up again with Piwik on the front page[1]. Their website was semi-down (HN hug of death) but eventually loaded. I wanted to see what their GA equivalent tracking code looks like but the page failed to load as rather than showing the cached copy, it tried to fetch a new one.&lt;p&gt;[1]: https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=13210195</text></story><parent_chain></parent_chain><comment><author>oneeyedpigeon</author><text>I wish View Source were more flexible. I would like:&lt;p&gt;* Raw: a view of the actual body as sent in the response. Although I&amp;#x27;m not aware of the current situation, at least some browsers used to subtly alter what was sent, even for View Source (possibly related to validity corrections). I want a &lt;i&gt;guarantee&lt;/i&gt; that what I&amp;#x27;m viewing is what the server sent.&lt;p&gt;* View source as it is today (with a good common understanding of what that means), but a bit more powerful. Give me a cursor so I can copy from the keyboard, for crying out loud! Maybe even let me edit the source so I can work with static pages more easily.&lt;p&gt;* Something in-between View Source and DOM inspector. E.g. the original source, guaranteed to be untouched by javascript, but cleaned-up for easier reading (given that the source returned by many websites nowadays is practically unreadable (take a look at this page, for example). Reformatting (where possible), maybe automatic expansion of any base href, consistent ordering of attributes, highlighting of errors, etc.</text></comment>