Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome: Inspect Element vs View Source

I am using Chrome 10 to receive a web service response in XML. The request completes successfully. I then want to view the content of the results.

I go to Inspect Element and see the desired XML. For curiosity, I also view source. I am pretty sure the way Chrome works is that Inspect Element is the correct results.

My issue is that the results in Inspect Element and View Source are different. In fact, Inspect Element gives the correct results while View Source provides an error. The error is an authentication error, so the response is still completing but acting like a failure.

Why are they so different?

like image 822
DDus Avatar asked Apr 06 '11 20:04

DDus


People also ask

Does inspect element show source code?

There's a powerful tool hiding in your browser: Inspect Element. Right-click on any webpage, click Inspect, and you'll see the innards of that site: its source code, the images and CSS that form its design, the fonts and icons it uses, the Javascript code that powers animations, and more.

What is view source used for?

View Source lets you look at the HTML or XML source for the page you're viewing. To activate View Source: context-click in the page and select View Page Source. press Ctrl + U on Windows and Linux, or Cmd + U on macOS.

Is inspect element useful?

Learning how to inspect elements in a browser is beneficial, especially if you work in IT. Inspect Element lets visitors access and temporarily edit a website's front-end source code, including its HTML, CSS, JavaScript, and image files.


1 Answers

View Source in Chrome sends another request for the file, and since it's not authenticated, it returns the source of the login page. This is different from the way say IE works, where the source is cached and returned when you try to view it.

Inspect Element shows the current DOM's snapshot data. This is what you got from making your initial, authenticated request. So yes, this is the "correct" one.

like image 118
Blindy Avatar answered Sep 28 '22 17:09

Blindy