Understanding Scripting

Understanding Scripting

Consider a scenario where you need to create a Web page for a Website called OnlineShop.com. The website facilitates users to register by using an online registration form . At the time of registration , the user has asked to select either of the two options , email or Mail, as the mode of communication. Upon selecting the email option, a user is provided a text field to enter a email address. However, if the user select the Mail option, a text area is provided to enter to enter the postal mailing address. The users are provided the statements of their transactions , acknowledgements receipts, or promotional offer mailers at the specified address. Such web pages can be developed by using a scripting language.

Types of Scripting

To create a dynamic and interactive Web page, you need to incorporate a block of code , which is known as script, in the Web page. The script can be executed either by the Web browser or by the Web server.

When a users request for a Web page through a Web browser, the request is sent to a computer that is placed at a different location on the World Wide Web(WWW). The computer on which the browser is running is known as the client, and the computer that receives the requests is known as the Web server.

When the Web server receives the request , it processes the request and sends the requested Web page to the client, which is, then, displayed in the browser window of the client.

                                                                Scripting can be of two types:

  • Client-side scripting
  • Server-side scripting

                                                                      Client-side scripting

Client-side scripting refers to the scripts that are executed at the client-side by the Web browser., running on the user's computer. Some of the languages used for creating client-side scripts are client-side JavaScripts (CSJS) and Visual Basic Script (VBScript) . When the Web browser requests the Web page , the server sends the requested Web page, which includes both , the HTML statements and the scripts statements, over the network. The Web browser reads the Web page and displays the results generated by interpreting the HTML statements. 

The communication between a client  and a server in case of client side scripting:

Server-side scripting

Server-side scripting refers to the scripts that are executed by the Web server on the basis of users request. Some of the languages used for creating server-side scripts are Server-Side JavaScripts (SSJS) Perl, PHP, and Visual Basic Scripts (VBScript).

Server-side scripts executing on the Web server. In this case the information need to be collected from the Web browser on the client side and is passed to a program or script that is executed on the Web server.  The script executing on the Web server performs certain tasks, such as establishing data base connection and verifying data sent by the Web browser from the client computer.

Server-side scripting allows database interaction and can be used to process client-side queries and store client data in a database . This features enables users to share and access information with other users of an application or a server. 

This communication between a client and a server in case of server side scripting:

Identify the benefits of JavaScript

JavaScript provides the following important benefits:
  • Handle events: JavaScript can be used to execute functions whenever an events is triggered. For example, when the user rolls the mouse over
    any image , its background changes.
  • Gather browser information: JavaScript can be used to gather browser information, such as the browser name and version. This information can be useful for the server to respond to client requests.
  • Manipulate cookies: JavaScript can be used to access and store users information, such as client preferences and authentication information of a client computer, in form of cookies.

Note: Cookies is a piece of data that is used to identify a user . It is stored in a users Web browser and is sent from a Web server while the users is browsing a website.

About Codingwelove

Recommended Posts × +


Post a Comment