I wish View Source were more flexible. I would like: * Raw: a view of the actual body as sent in the response. Although I'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 guarantee that what I'm viewing is what the server sent. * View source as it is today (with a good common understanding of what…
Ask HN: Why does 'View Source' issue a new HTTP request?
31–40 of 97 posts
Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#32Earlier quoted context omitted.
How much memory is saved here? http://www.httparchive.org/interesting.php?a=All&l=Dec%202%2... 52 _kilobytes_ ? Really?
The browser would have to save the source text for EVERY tab it opens, regardless of whether you view source or not. That seems more onerous than making a separate request for the source code every once in a while.
So, the browser should load the HTML page into a part of memory that can be discarded by the OS if the OS needs more memory. Actually I think it is strange that no such memory API exists in Unix.
EDIT: Anyway, storing it in the browser's file cache would also do the trick, I suppose :)
Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#33It's a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=307089 Or, it's a memory saving feature. To implement "View source from cache" 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.
Couldn't you reconstruct the source from the internal dom representation anyway?
So it is impossible to find errors usually. So things like:
the parser will correct, and therefore the DOM will be correct. But what it does to fix this may break your site. I often found the CSS would be screwed up for many reasons (rules don't match DOM structure -- due to bugs all over our codebase)Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#34Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#35It's a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=307089 Or, it's a memory saving feature. To implement "View source from cache" 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.
Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#36Earlier quoted context omitted.
The browser would have to save the source text for EVERY tab it opens, regardless of whether you view source or not. That seems more onerous than making a separate request for the source code every once in a while.
Yes, but if you have more than enough memory, then that's no problem. So, the browser should load the HTML page into a part of memory that can be discarded by the OS if the OS needs more memory. Actually I think it is strange that no such memory API exists in Unix. EDIT: Anyway, storing it in the browser's file cache would also do the trick, I suppose :)
Your suggested solution, about discarding when memory is needed, solves this problem. But it solves a problem that would be created by needlessly storing a lot more data than needed. So it's a solution to a problem that was not a problem to begin with.
But I know, if it's a few kb, it will not make a huge difference.
Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#37I seem to recall that it wasn't always the case.
Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#38I wish View Source were more flexible. I would like: * Raw: a view of the actual body as sent in the response. Although I'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 guarantee that what I'm viewing is what the server sent. * View source as it is today (with a good common understanding of what…
Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#39Re: Ask HN: Why does 'View Source' issue a new HTTP request?
#40It's a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=307089 Or, it's a memory saving feature. To implement "View source from cache" 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.