The Computer Oracle

Is it possible to change Chrome's view-source behaviour to use the current request instead of starting a new one?

--------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Industries in Orbit Looping

--

Chapters
00:00 Question
01:07 Accepted answer (Score 11)
02:11 Answer 2 (Score 2)
02:49 Thank you

--

Full question
https://superuser.com/questions/243967/i...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#googlechrome

#avk47



ACCEPTED ANSWER

Score 11


Is there a way to change the way Google Chrome's view-source works, so that it does not initialize a new request?

No, this is the way Chrome works by design.

When you "view source", you're really opening a new tab that opens the page again and displays the source rather than renders the page. Many web pages are dynamic and modify their HTML content (eg. using JavaScript/XMLHttpRequest) so we cannot display the current HTML - this is why a new request is made.

If you want to view the current state of a dynamic page, you should use the inspector. "File icon -> Developer -> JavaScript console"

I don't see how this is a security bug or a bug at all - the behavior is by design - closing as such.




ANSWER 2

Score 2


I don't think you can change the behavior of view-source: URLs, or the View page source command, you can get to the source as received for this page: first, open the Developer tools (WebKit's "Web Inspector"), found at Wrench > Tools > Developer tools. Now click on Resources and (if necessary) scroll down the list on the left until you find the resource of interest. And there you go: the source as it was transmitted in the original HTTP response.