Automatic HTTP browser requests
Let's say you use a browser to visit a certain page of a certain website:
GET /test.html HTTP/1.1
Host: example.com
Let the query return the following HTML code as its result:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="styles.css">
<script src="scripts.js"></script>
</head>
<body>
<img src="images/img.png">
</body>
</html>
The browser's work does not end there, because only the HTML code has been loaded, and this is not enough to display the page. After loading the HTML, the browser analyzes it and sees that the code contains connections of styles, scripts, and images. At this point, the browser itself automatically sends requests to the server.
In this case, a separate HTTP request is generated for each resource. That is, for example, a separate request will be sent for each connected CSS file.
How many HTTP requests will the browser make after loading the following page:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="styles.css">
<script src="scripts.js"></script>
</head>
<body>
<img src="images/img1.png">
<img src="images/img2.png">
<img src="images/img3.png">
</body>
</html>