How do web browsers work and how are web pages displayed?
So you've been surfing the web using your favourite browser? Maybe you spend a few minutes each day or you may be "hooked" and it takes the force of ten elephants to take you away from your computer; I know, the web is really an interesting place.
To load a web page you type in a URL or select a link from the favourites/bookmarks, hit the Enter key and are taken to a web page. You are not concerned what goes on behind the scene. But have you ever wondered how a web browser works and displays the web page on your computer? If yes, I assure you it's going to be an interesting read.
Web browsers and web pages/sites - a brief history
A web browser, as you probably know, is a computer program that displays web pages and web sites. If you didn't know that, I suggest you read the article that provides a brief on web browsers - what is a web browser. These programs, also called clients. come in different flavours and versions, like Internet Explorer for Windows or Safari for Macs or Firefox which can run on several different operating systems. [There are tons of browser available; check the web browsers list ].
First, a little history. Web browsers are what made the web "happen". Before these programs came into existence, the Internet was a pretty bland place, as some would say, with digital information (like text documents, images, music files) scattered around with nothing to "link" them up.
For example, if you wanted the lyrics of The Doors, you would first hunt for a plain text document that had those lyrics and if you wanted pictures of the famous 60s music group, you would have to indentify these by the file names (assuming that the picture was named properly and correctly).
Web browsers tied up text and images (and other media, like animation) together. You could now view a web page with text and images on your screen. And what was responsible for making this happen?
Enter HTML (HyperText Markup Language, for those who want to know what it stands for), which is a simple "programming" language based on tags that provided instructions for creating web pages such as where to place an image or which text to be made large or which one to be put in italics. Web browsers could understand and interpret HTML and display the web page to the viewer.
Remember, the images and other media such as music files, animation are separate from the actual web page HTML file and are only embedded on the page when its displayed by a browser.
How does a web browser work?
As you already know, to view a
web site or a web page in a browser, you would either type in the URL or click on a link (as one in your Favorites/Bookmarks) and hit the Go button. Now, the page you have asked the browser to display would probably be located on a Server computer far far away. The web browser program sends a request (Could I have the web page please? ) to a web server program running on the remote computer. Newbies may be baffled here due to similarity of names. the computer on which the web site is stored is called a Server (uppercase) and it runs a program (confusingly) also called a server (all small case).
Purists try to differentiate the computer (hardware) and program (software) by having the first letter in capitals (as in Server) but this is not a rule. Anyway, the server program, gathers the request from the web browser, tries to hunt for the web page and then formulates a response. This response will differ depending on whether the server program was able to find the requested web page or web file. Assuming, the server was able to locate the web page, it sends the HTML file to the web browser. The browser picks up all the information coming in from the server and does its best to display the web page. A typical web page not only has text but also images and these are separate files that need to be transferred from the server to the browser.
So the browser-server communication goes on till all the files have been transferred to the browser. Once the files arrive at your computer, the browser-server connection is severed - cut - chopped! If you now click on any link on this web page or even refresh the page, the process starts all over again. FYI, this is called the client-server architecture .
One important point remains - let us say you are looking at two different web pages of the same web site (such as ebay auctions) from two computers simultaneously using the same internet connection. How does the ebay server program know which page (and its associated images and other files) to send to which computer?
The answer to this seemingly complicated question lies in the request and response headers sent by the browser and server, respectively. So each request and response has a header that contains details such as the computer name (actually the I.P. address) so everything is in tune.
Finally, the information over the web is transferred using a set of rules called the HyperText Transfer Protocol (HTTP). Read more about this if you want to get you hand at details.
How about voting for your favorite web browser below. Also check what others think.Source: www.webdevelopersnotes.com