What Allows Web Browsers and Servers to Send and Receive Web Pages?

How the Web works

  • Previous
  • Overview: Getting started with the web

How the web works provides a simplified view of what happens when you view a webpage in a web browser on your computer or phone.

This theory is non essential to writing spider web lawmaking in the brusk term, simply earlier long yous'll really start to benefit from understanding what's happening in the background.

Clients and servers

Computers connected to the spider web are called clients and servers. A simplified diagram of how they interact might look like this:

Two circles representing client and server. An arrow labelled request is going from client to server, and an arrow labelled responses is going from server to client

  • Clients are the typical spider web user's net-connected devices (for example, your computer connected to your Wi-Fi, or your phone connected to your mobile network) and spider web-accessing software bachelor on those devices (ordinarily a web browser like Firefox or Chrome).
  • Servers are computers that store webpages, sites, or apps. When a client device wants to access a webpage, a copy of the webpage is downloaded from the server onto the client car to exist displayed in the user's web browser.

The client and server we've described above don't tell the whole story. In that location are many other parts involved, and we'll describe them beneath.

For at present, let'southward imagine that the web is a road. On one end of the route is the client, which is like your house. On the other end of the road is the server, which is a shop you lot desire to buy something from.

In addition to the client and the server, nosotros likewise need to say hullo to:

  • Your internet connexion: Allows y'all to ship and receive information on the web. It's basically like the street betwixt your house and the store.
  • TCP/IP: Transmission Control Protocol and Internet Protocol are communication protocols that ascertain how information should travel across the internet. This is like the transport mechanisms that let you place an order, go to the store, and buy your appurtenances. In our example, this is like a car or a bike (or however else y'all might become around).
  • DNS: Domain Name System is like an address volume for websites. When you type a web accost in your browser, the browser looks at the DNS to observe the website'due south IP accost before it can retrieve the website. The browser needs to notice out which server the website lives on, and so it tin can send HTTP letters to the right place (run into below). This is like looking upward the address of the store and then you can access information technology.
  • HTTP: Hypertext Transfer Protocol is an application protocol that defines a linguistic communication for clients and servers to speak to each other. This is like the linguistic communication you use to lodge your goods.
  • Component files: A website is made up of many unlike files, which are like the different parts of the goods y'all buy from the shop. These files come in two main types:
    • Code files: Websites are congenital primarily from HTML, CSS, and JavaScript, though you lot'll come across other technologies a bit afterward.
    • Assets: This is a commonage proper name for all the other stuff that makes upwardly a website, such as images, music, video, Discussion documents, and PDFs.

So what happens, exactly?

When you lot type a web address into your browser (for our analogy that'southward like walking to the shop):

  1. The browser goes to the DNS server, and finds the real accost of the server that the website lives on (you detect the accost of the store).
  2. The browser sends an HTTP request message to the server, asking it to send a re-create of the website to the client (you go to the shop and social club your appurtenances). This message, and all other data sent betwixt the client and the server, is sent across your internet connection using TCP/IP.
  3. If the server approves the customer'due south asking, the server sends the client a "200 OK" message, which ways "Of course yous tin can expect at that website! Here information technology is", so starts sending the website's files to the browser equally a serial of small chunks called data packets (the shop gives you your appurtenances, and you bring them back to your firm).
  4. The browser assembles the minor chunks into a complete web page and displays it to you (the goods arrive at your door — new shiny stuff, awesome!).

Guild in which component files are parsed

When browsers send requests to servers for HTML files, those HTML files often incorporate <link> elements referencing external CSS stylesheets and <script> elements referencing external JavaScript scripts. It's important to know the order in which those files are parsed by the browser as the browser loads the folio:

  • The browser parses the HTML file first, and that leads to the browser recognizing any <link>-element references to external CSS stylesheets and any <script>-element references to scripts.
  • As the browser parses the HTML, information technology sends requests back to the server for any CSS files it has constitute from <link> elements, and any JavaScript files information technology has institute from <script> elements, and from those, and so parses the CSS and JavaScript.
  • The browser generates an in-memory DOM tree from the parsed HTML, generates an in-memory CSSOM construction from the parsed CSS, and compiles and executes the parsed JavaScript.
  • As the browser builds the DOM tree and applies the styles from the CSSOM tree and executes the JavaScript, a visual representation of the folio is painted to the screen, and the user sees the page content and can brainstorm to interact with it.

DNS explained

Existent web addresses aren't the dainty, memorable strings you type into your address bar to notice your favorite websites. They are special numbers that look like this: 63.245.215.xx.

This is called an IP address, and it represents a unique location on the web. However, it'south not very like shooting fish in a barrel to call back, is information technology? That'southward why Domain Proper noun Servers were invented. These are special servers that match up a spider web address yous type into your browser (like "mozilla.org") to the website's real (IP) accost.

Websites can be reached direct via their IP addresses. Y'all can find the IP address of a website by typing its domain into a tool like IP Checker.

Packets explained

Before we used the term "packets" to describe the format in which the data is sent from server to client. What do nosotros mean hither? Basically, when information is sent beyond the spider web, information technology is sent in thousands of small chunks. There are multiple reasons why data is sent in small-scale packets. They are sometimes dropped or corrupted, and information technology'due south easier to supplant small chunks when this happens. Additionally, the packets can be routed along different paths, making the exchange faster and allowing many different users to download the same website at the same time. If each website was sent equally a single big chunk, just one user could download information technology at a fourth dimension, which obviously would make the web very inefficient and not much fun to use.

Run across also

  • How the Internet works
  • HTTP — an Application-Level Protocol
  • HTTP: Let's Get It On!
  • HTTP: Response Codes

Credit

In this module

  • Installing bones software
  • What volition your website look like?
  • Dealing with files
  • HTML basics
  • CSS basics
  • JavaScript nuts
  • Publishing your website
  • How the web works

clintonplase1950.blogspot.com

Source: https://developer.mozilla.org/id/docs/Learn/Getting_started_with_the_web/How_the_Web_works

0 Response to "What Allows Web Browsers and Servers to Send and Receive Web Pages?"

Publicar un comentario

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel