Live data from Hacker News

Ask HN: Why does 'View Source' issue a new HTTP request?

news.ycombinator.com

51–60 of 97 posts

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#51

Earlier quoted context omitted.

Am I in some parallel universe here ? We are talking about hundreds of KBs of memory total which is nothing and if it's a worry for mobile devices we have the disk. It's not a feature that demands instant performance.

> It's not a feature that demands instant performance. Hence it's acceptable to request the document from the server when opening 'View Source'.

No, because when you want to view the source you mean to view the source of this very document, not the source you'd get by asking to reload the page, it is often different.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#52

Earlier quoted context omitted.

Isn't that one of the issues nowadays, that people have the attitude "we have enough memory" and thus don't tend to care about optimizing for memory usage anymore. 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…

> "we have enough memory" Your phone is in disagreement.

My phone has a quite insane 3 GB of RAM.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#53

Earlier quoted context omitted.

Couldn't you reconstruct the source from the internal dom representation anyway?

No. The parser corrects and changes the source to make the DOM. 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)

Also, changes made by client-side JS.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#54

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…

Hit F7 for caret browsing.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#55
post #2

I usually have Fiddler running constantly in the background. If a page is slow to load and I want to see the HTML, I would find the actual HTTP request in fiddler and grab the HTML that way. Alternatively, the element inspector doesn't re-issue the request, but it will show the compiled HTML, so after DOM augmentation etc

Is there anything comparable to Fiddler for macOS? I heard you can run it in VM but that's just too much brute force for me.

Burpsuite has interception proxy and runs on Java.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#56

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…

You can always use curl. Chrome allows you to copy paste a full curl command (with all the arguments and cookies) to issue an identical http request.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#57
post #56

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…

You can always use curl. Chrome allows you to copy paste a full curl command (with all the arguments and cookies) to issue an identical http request.

Provided the content hasn't changed. Sometimes you have a bug that goes away when you refresh the page.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#58

It'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.

Why keeping the original source in memory? Why not saving it to disk?

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#59
post #56

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…

You can always use curl. Chrome allows you to copy paste a full curl command (with all the arguments and cookies) to issue an identical http request.

Identical Http requests don't necessarily return identical data.

Re: Ask HN: Why does 'View Source' issue a new HTTP request?

#60
post #27

Earlier 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.

Am I in some parallel universe here ? We are talking about hundreds of KBs of memory total which is nothing and if it's a worry for mobile devices we have the disk. It's not a feature that demands instant performance.

But who does this feature help exactly? A _tiny_ number of users. Chrome is currently using over 3GB on my machine. Anything they can do to trim that without affecting performance is worth it to me.
Post reply on HN