Difference between client side scripting and Server side scripting languages

This post is for beginners who are learning web development. I am trying to explain the basic difference between client side programming and server side programming. This was a question I had for many years till I become a full time WordPress Developer.

Client side programming

Any piece of code that runs in browser is a client side programming. I know you will say that all web related scripts will run/show output in a browser. But, If you can write a code save it anywhere in your computer like desktop and open that file in browser, you should see the output. For example, If I write a code which will have following

  • HTML
  • CSS
  • Javascript

In following example code there is nothing too complicated. All you need is a text editor to write this code, save the file as “.html” file and open it in your favorite browser to see the output. It is as simple as it said.

The expected output will be as follows:

Server side programming

Now lets get in deep with the same HTML code where you need to show a content from PHP variable or from a database. Your code looks like following and you need to save it as “.php” file.

This piece of code when you save and run from desktop, this will give you a blank space or some unexpected results where you used PHP code. So, PHP code cannot run in a browser, because browser cannot understand PHP. It needs a server, there comes Apache(Wamp or Xamp) or Nginx. The server will process the PHP code and outputs relevant HTML data. This will be showed in the browser as output.

In a nutshell

All the scripts that runs in browser without any help from any server is Client side scripting/programming languages. Examples:

  • HTML
  • CSS
  • Javascript
  • jQuery
  • SaaS
  • SCSS
  • etc..

All the scripts that runs in browser with help from any server is Server side scripting/programming languages. Examples:

  • PHP
  • Python
  • JSP
  • Ruby

P.S : Recent improvements in JS like releasing ES6 with tons of features and upgrades in javascript, we have Node.js which is a javascript library that has capability to connect with database and act like a server side scripting.

Share this post