AndreiBogdan
AndreiBogdan

Reputation: 11174

Who knows which files should be included in a website?

When the browser requests a website, any website from a HTTP server, which of the two parses the site's content in order to know which other files need to be included on the webpage?

What I mean is this:

  1. the browser asks for the html file and then observers that it needs to import some external css files and HE is the one who requests them.

OR

  1. the HTTP server when faced with a request for a website, parses (already knows) which sites need to be linked to a certain webpage and sends them alongside the html page?

I'm guessing the first case is the correct one, but if someone can confirm and maybe clarify it, I'd appreciate it.

Upvotes: 0

Views: 41

Answers (2)

Anirudh
Anirudh

Reputation: 874

According to Wikipedia -

The primary function of a web server is to cater web page to the request of clients using the Hypertext Transfer Protocol (HTTP). This means delivery of HTML documents and any additional content that may be included by a document, such as images, style sheets and scripts.

and

The primary purpose of a web browser is to bring information resources to the user ("retrieval" or "fetching"), allowing them to view the information ("display", "rendering"), and then access other information ("navigation", "following links").

It is the Browser that parses the HTML and request for the associated contents.

Upvotes: 1

Barmar
Barmar

Reputation: 781804

It's all done by the client (which is usually a browser). When it sees <script>, <iframe>, <img>, <link>, etc. tags that reference other documents, it downloads them if necessary.

Upvotes: 1

Related Questions