tags:

views:

58

answers:

4

Are all assets (html files, js files, css files, images) in one webpage transmitted through a single HTTP request/response, or through multiple HTTP requests/responses, one for each asset? Assumed no XHR in that webpage.

+3  A: 

All the digital assets on a web document are transmitted on separate HTTP requests. However modern web servers and browsers are able to use the same TCP connection with HTTP keep-alive.

Daniel Vassallo
It's also worth noting that these multiple requests may reuse the same connection.
Josh Einstein
@Josh: I was just adding it :)
Daniel Vassallo
A: 

It's one request per asset, but you can use multiple TCP connections to send multiple HTTP requests in parallel. In fact all browser do exactly that.

Dmitry Kakurin
+2  A: 

Conceptually, each asset is a separate request. In practise, most servers allow the browser to re-use the same physical socket connection for multiple requests (but they are still issued one after the other) and this can significantly improve performance (because you need extra round-trips to establish a connection, and subsequent requests can piggy-back on the ACKs for the previous request: you cut down on a lot of round-trips).

But yes, there is always one request/response per asset on the page.

On connections with high latency (e.g. Australia -> U.S.) the number of round-trips can be a significant bottleneck, and that's why things like CSS sprites are widely used.

Dean Harding
A: 

I'd recommend downloading Firebug for Firefox, then watching its 'Net' tab while you browser some sites. It would answer this question and so many more.

Frank Schwieterman