Website scripts run in one of two places – the client side, also called the front-end, or the server side, also called the back-end. The client of a website refers to the web browser that is viewing it. The server of a website is, of course, the server that hosts it.
Most web coding languages are designed to run on either the server side or the client side. This largely defines how they work. Here are some examples.
Client Side Languages
<script> document.getElementById('hello').innerHTML = 'Hello'; </script>
<h1>. What was originally inside that element gets replaced, but if you open up the source code of that page, you’ll still see that original text and not ‘Hello’.
Server Side Languages
A server side or back-end language runs its scripts before the HTML is loaded, not after.
There are a range of server side languages in use on the web today. PHP is one of the most popular, as well as Ruby on Rails, ASP.NET and many others. They are called server side languages because their scripts are run not on your computer, but on the server which hosts the website and sends down the HTML code.
Consider this PHP code:
<h1 id="hello"><?php echo 'Hello'; ?></h1>
<h1> element with an ID of ‘hello’. But view the HTML source and what you see is a different story. Inside the
<h1> tags will be the string ‘Hello’.
On the other hand, the PHP code that was run by the server will be nowhere to be seen. This is because the server will have already taken care of the PHP, and what gets sent to your computer is the resulting pure HTML.
Most websites make use of both a client side and a server side language. Although there are things both can do, there are some things which can only be done server side, and there are some things which can only be done client side.
Front-end scripting is good for anything that requires user interaction, such as a simple game. Back-end scripting is good for anything that requires dynamic data to be loaded, such as a notice that tells the user they’re logged in.
To write your own front-end and back-end scripts, you should learn web development.
Recommended Training – Code School