Answer the question
In order to leave comments, you need to log in
How does the browser know where to download site files from?
Hello. When we open the site, a request is made to the server and a response is received. There are styles on the page, the path of which is written like this: css/style.css
How does the browser know that these styles need to be loaded from this particular site? Does it get it from some http header or what? If so, is it possible to send another domain (host) in response, i.e. to make the browser load styles from another domain?
Please do not write that you just need to change the path to the style or the like.
Answer the question
In order to leave comments, you need to log in
If the styles are written like this:
<link rel="stylesheet" href="http://example.com/css/style.css">
<link rel="stylesheet" href="//example.com/css/style.css">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="css/style.css">
https://mysite.com/hello/world.html
an attempt will be made to connect styles like this: https://mysite.com/hello/style.css
and this will most likely lead to an error. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question