Requesting a Web Page
Describe the sequence of events executed by the client computer and web server when a web page consisting only of HTML tags is requested and displayed by a browser
First the user types in the web address they wish to visit (www.bbc.co.uk for example) in their web browser. This request is then sent to the DNS servers which look up the IP address of the web server that is holding the data requested. For the BBC example, one of the web servers it may go to is 212.58.246.93 to return this information.
You can see this by using ping command on the command line: |
|
Once a connection has been made with the web server, it starts to send the data back in small chunks called packets. The data is made up of HTML, CSS and any client-side script. When they are received by the web browser it displays the web page to the user.
Client-side Script
- recognise and identify the purpose of some simple JavaScript code
- describe the sequence of events executed by the client computer and web server when a web page with embedded client-side code is requested and displayed by the browser
- show understanding of the typical use of client-side code in the design of an application
Client-side script is code that is sent to the client from the web server contained within the HTML data (or sometimes linked to an external file). The client-side script runs on the user's machine in the web browser. It may run the moment the web page loads or when an action occurs, like the clicking of a button.
To learn some basic JavaScript it is a good idea to complete a beginners course on a website like Codecademy or W3Schools. Here are the links to their tutorials: Codecademy: Javascript Course W3Schools: Javascript tutorial The advantages to using client-side scripting is that it can take pressure off the web server as the code runs on the client's machine. It can also perform checks on user input, like registration forms, and try to make sure that the data entered is valid before sending it back to the server. However, client-side scripting can be potentially unsafe as it can be used maliciously if the user is tricked into running code that can cause damage to their computer. It can also be used to hack websites by using cross site scripting (XSS), as explained in the videos opposite. |
|
Server-side Script
- recognise and identify the purpose of some simple PHP code
- describe the sequence of events executed by the client computer and web server when a web page with embedded server-side code is requested and displayed in the browser
- show understanding that an appropriately designed web application for accessing database data makes use of server-side scripting
Server-side script is code that is run on the web server when a data request is received. It runs before it sends the data packets back to the client machine. The purpose of server-side script is to give a customised response to the person requesting the web page. Facebook is a good example of this, where the web server returns data that is customised to your login account - otherwise everyone would see the same web page.
A database is also normally involved which will hold the website data, the server-side script queries this data and places the data needed in the right places within the HTML document. The HTML document is mainly just a shell without any specific data, and the server-side script populates it with data relevant to the user before it is sent back to the client machine. PHP and ASP are two popular server-side scripting languages.
Again, Codecademy and W3Schools are good websites to use if you would like to learn more about server-side scripting. Here are links to their courses and tutorials:
Codecademy: PHP Course
W3Schools: PHP Tutorial
A database is also normally involved which will hold the website data, the server-side script queries this data and places the data needed in the right places within the HTML document. The HTML document is mainly just a shell without any specific data, and the server-side script populates it with data relevant to the user before it is sent back to the client machine. PHP and ASP are two popular server-side scripting languages.
Again, Codecademy and W3Schools are good websites to use if you would like to learn more about server-side scripting. Here are links to their courses and tutorials:
Codecademy: PHP Course
W3Schools: PHP Tutorial