In this article i try to cover the concept of how the internet works for the web developers perspective. what do you need to know about how the internet works.
from the front-end developers point of view the internet is your browser (your machine) makes a request to the server and the server response to it.
the server is another machine connected to the internet.
the browser can be iPhone, google chrome or whatever, server (machine) connected to the internet and has IP address.
you can user your computer as a server but you don’t have a server software installed and running.
so simply browser makes request to server to get some data or files from the server and server response to the browser.
so when i say my website.com the server responses with the index file and browser gets the data and treats it as HTML document then while browser reading the HTML doc. will find a style sheet with its path so browser again makes a request to the server asking it about the style sheet and server makes response to browser request. so we put the style sheets in the header to let the browser gets the style and make it beautiful 🙂 the same thing with the scripts but we put it an the end of the body.
a way to make our website faster is by putting all our scripts in one script to make only one request to the server to get a script instead of sending many requests “that’s good ;)”.
another way that will help to make our website faster to load is minify the css sheets to smaller size that’s will make it easy to load sheets from the server.
After all a request is just a request to the server and the server determines what you get back by its content type so that’s kind of the browser world of things.
let’s look at some sample requests let’s look what’s going on and so a request contains two things it contains headers and it may or may not contain a post body.
so when we request google.com
so let’s look at header request it contains host which is http://www.google.com, method which is GET and there is not path we only need google.com without any ‘/’ and you can find cookie which is information that website stores it in your browser and finally you can find user-agent which contains information about the your browser. in the response headers you can find the content-type which is text/html and status: 200 OK.
Please watch these videos for more information about internet.
- How the Internet Works for Developers – Pt 1 – Overview & Frontend
- How the Internet Works for Developers – Pt 2 – Servers & Scaling