Scripting is the magical fairy dust that makes websites interactive. In the early days of the internet, websites were static HTML pages. The only interactivity was in the Hypertext links that took you to another static page. Soon after, forms were implemented into HTML and the Common Gateway Interface was developed which allowed programs to interpret information sent via the forms. These early programs were written on an adhoc basis, in high level programming languages not designed for the web. Later programming languages were developed specifically for the web, including Perl, PHP, Java and JavaScript.
Initially scripting was used for trivial purposes like changing images when hovered over with the mouse or page view counters. Today, scripting enhances the majority of websites with millions of eCommerce websites and social media juggernauts like Facebook and Twitter.
Scripting is essential for any of the following web applications:
Scripting can be divided into server side scripting and client side scripting. Client side scripts are executed on the client. The client is the device viewing the website. Server side scripts are executed on the server – the same server that provided the web page to you. Both modes of scripting go hand in hand, passing data to each other through web page loads and AJAX function calls.
Server scripts run when the server responds to a request. Requests are received when:
The script looks at information in the request and constructs a suitable response. Sometimes the response will constitute a whole new web page to be viewed on the visitor’s browser, and other times the response will be a small chunk of data.
In most modern dynamic websites, the server side script fetches the information it needs to fulfil a request from a database. Server side scripts can add new information to the database, and/or edit and delete existing entries. Server side scripts are usually the main interface between the user and the database. The database structure and the server side code are usually developed hand in hand.
A typical use scenario for server side scripting would follow the chain of events below:
price
, description
, title
etc.Server side scripts are written in a variety of programming languages. At Phoenix Web Development, we mostly write server side scripts in PHP. Other server side scripting languages include ASP, Java and Perl.
This Upwork article contains additional information about server side scripting.
Client side scripts are downloaded from the server to the web browser and then executed with the browser’s script engine. They are used to make changes to the user’s screen and send requests to the server for processing by a server side script. These operations are triggered by events. A few examples of events which function as triggers:
To change the user’s screen, the client side script interacts with and manipulates the HTML on the page and/or changes how elements look by changing the CSS. To make requests to the server, the client side script uses AJAX technology.
A typical use case scenario for a client side script would be the following:
Client side scripts runs faster than server side scripts, as they do not have to wait for a HTTP request to be sent and received. This makes operating an interface seem more seamless for the user. For this reason, functionality that could run on either server or client, is moved to the client whenever possible.
Today virtually all client side scripting is written in JavaScript. JavaScript established inertia early on when it became the first client side scripting language to be utilised across all web browsers.
Writing scripts that meet the needs of a specific business scenario is the bread and butter of web agencies like Phoenix Web Development. Over the history of the web, several good practices have emerged that should be adhered to. Just a few include:
Read more about web scripting at these resources: