Question

When I request a web page, assuming that this web page contains images, css and js files, how does http response look like? is it one response with multiple entities (img, css, js, text/html ....) or multiple response packets will be sent back to my browser each with a single entity?

Was it helpful?

Solution

get the Google Chrome. Then go to View -> Developer -> Developer Tools. With the developer tools open, go to the tab "Network".

Now, with tha developer panel open. Go to the address bar of the browser and type something like http://csb.stanford.edu/class/public/pages/sykes_webdesign/05_simple.html

Then you can see all the files that the browser is requesting via HTTP.

As you can see, the HTTP response does not come with everything you see on the website. But the main page has references to images and CSS, then the browser parses this content and get the other items. A new HTTP request is make for each item [an image or a CSS file] of the webpage. Explore the tool and you will figure out how it works. Of couse... learn more about HTML.

OTHER TIPS

If you request www.example.com, the response will be the default HTML document, probably index.html. This file will contain links to resources, like CSS files, Javascript files, images... etc... then the browser will proceed to download all those resources.

http://mkcohen.com/how-the-web-works-in-one-easy-lesson

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top