How Tasks Are Performed By Client-Side Scripts And Server-Side Scripts

A group of Information Technology students were given the chance to interact with the guys at Perth Web Design. I was one of the students in the group and the successful interaction with the guys inspired me to write down this post.

How does client-side scripting differ from server-side scripting?

Scripts in the client-side environment are processed on the user’s computer. The source code is transferred from the web server to the user’s computer through the internet and runs directly on the browser. However, scripting language must be must be enabled on the client’s computer. Users who are extra cautious of security usually switch the scripting facility off so that when a script is attempting to run, a message usually pops up to alert the user.

In the server-side environment, the scripting language is a web server. When there is a request from a user, it is fulfilled by running the script directly on the web server so that it will be able to generate dynamic HTML pages. HTML is then sent to the client’s browser so that interactive web sites can interface with the database on the server.

Script-server scripting has the advantage of being able to customize the response according to the user’s requirements, access rights and the queries into the data stores.

The ability to specify whether the script should run on the client side or on the server side is a feature provided by web scripting. It also allows the web designer to specify the run-time environment for the task he wants performed. For example, some of the tasks usually performed using client-side scripts include:

  • Changing the text or appearance of a page at the time that it is loaded into the browser or in response to an event such as a click on the button
  • Validation is performed on data that is entered in HTML form prior to sending it to the server. For example, it ensures that an employee number contains all the right digits by verifying it against the data on the database.
  • Information is displayed in response to a user’s button click

The decision to use client-side scripts or server-side scripts will depend not on the task that has to be accomplished but on the environment where the application runs including special constraints like performance.