answersLogoWhite

0


Best Answer

Partly because the available scripting languages are different: JavaScript runs primarily in the browser, which server side languages like PHP, JSP, Ruby on Rails etc. cannot do.

Partly because the tasks are different: The server may do things like database lookup, reading/writing files and user authentication that would be either impossible or very insecure to do in a browser.

That said, there are a number of tasks that can be done either on the client or the server, like generating the HTML for the page.
There are also a couple of tasks that are commonly done both places, like form validation - on the client to give quick feedback and on the server to ensure that what is submitted is actually safe and valid. (An attacker could easily skip any browser validation and submit illegal values.)

If you wish to share as much code between client and server as you can, server side JavaScript exists, so it is possible to use the same language both places. There will still be different scripting, as there are tasks that can only be done on the server.

See related link for some server side JavaScript options.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why do you need different scripting for client and server side?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are client side and server side scripting?

Client side scripting is a script, (ex. Javascript, VB script), that is executed by the browser (i.e. Firefox, Internet Explorer, Safari, Opera, etc.) that resides at the user computer. Server side scripting, (ex. ASP.Net, ASP, JSP, PHP, Ruby, or others), is executed by the server (Web Server), and the page that is sent to the browser is produced by the serve-side scripting. So when a server sends out a page, it executes server-side scripts, but does not execute client-side scripts. Once the browser receives the page, it executes the client-side scripts. Server side scripting can connect to databases that reside on the web server or another server reachable from web server. Client side scripting cannot do that. Server side scripting can access the file system that reside at the web server, client side cannot. Server side scripting can access settings belong to Web server while client side cannot. Client side scripting can access files and settings that are local at the user computer. Client side scripting consumes cycles from user's computer not web server one, while server side scripting consumes cycles form web server one.


How do you save the input from an HTML form to a notepad document?

You can't. You need a Server-side scripting language such as php.


What is the difference between client side scripting and server side scripting languages?

Best Practice : Use both The Cons of using one or the other : With client side validation only, if a user disables JavaScript, then no validation will occur. With server side validation only, there are more return trips to the server which in turns uses more resources and slows down the site when a client side script could have done the validation without the server. The Pros of having both : The data will always be validated, whether or not the client has JavaScript enabled or not. There will be less server strain with the client side validation. The client can fix form errors faster with instant client side notifications. The data will have a bit more integrity going through the dual validation process.


How does files in javascript act as a backend?

Javascript is a client-side script, meaning it runs only in the browser. It has no access to the server. For access to the server, thus creating a back-end, you need to use a server-side scripting language such as ASP or PHP. If you want to make a more fluid interface, JavaScript and AJAX can be combined with one of the two aforementioned server-side scripts, effectively creating a back-end and a front-end.


What is the simple differences between client and server?

Client is when the images, animation, and other things on the page is not needed to go back to the server and load it all. Server is when the images, animation, and other things on the page need to be taken from the server every time. Its very useful to have Client because that way all the information on your page does not need to be reloaded every time. instead it is stored in history and is retrieved much faster.

Related questions

What are client side and server side scripting?

Client side scripting is a script, (ex. Javascript, VB script), that is executed by the browser (i.e. Firefox, Internet Explorer, Safari, Opera, etc.) that resides at the user computer. Server side scripting, (ex. ASP.Net, ASP, JSP, PHP, Ruby, or others), is executed by the server (Web Server), and the page that is sent to the browser is produced by the serve-side scripting. So when a server sends out a page, it executes server-side scripts, but does not execute client-side scripts. Once the browser receives the page, it executes the client-side scripts. Server side scripting can connect to databases that reside on the web server or another server reachable from web server. Client side scripting cannot do that. Server side scripting can access the file system that reside at the web server, client side cannot. Server side scripting can access settings belong to Web server while client side cannot. Client side scripting can access files and settings that are local at the user computer. Client side scripting consumes cycles from user's computer not web server one, while server side scripting consumes cycles form web server one.


Can a client act both as a client and server in a client and server network?

Yes, it can if the client is offering resources to others. It is important to note, however, that the client still is using client software and is not considered to be a server even if offering resources to others. That is, its role may change temporarily but it is still running client OS software.


What is the role of a network in client-server architecture?

Simple: in order to have a client-server architecture you need a network. The role of the network is to move data packets between the client and the server. In a client-server architecture the server usually has to manage the network (for example, a domain controller in a Windows environment).


If a TCP server were to support n simultaneous connections each from a different client host how many sockets would the TCP server need?

n + 1


Why is PHP superior to Client side scripting languages such as Javascripting?

Website scripts run in one of two places - the client side or the server side.Client side development is done almost exclusively in JavaScript. This is, in addition to basic HTML and CSS code.So This is the main Reson Javascript is called Client Side scripting language. For Serverside PHP is used,Because PHP is used for development the Dynamically Website. And PHP Need atlist one serve.


How do you animate in php?

There's no direct way to do animation in PHP, as it's a server side scripting language. That means that from the browser's point of view, there is no PHP code. It's just a static document that happens to be generated using PHP on the server side. If you want to do animation, you'll need to include client side scripting such as Javascript or Flash (or an animated GIF if something that simple meets your needs).


You are testing client server program how can test it in one computer making a single PC both client and server?

It's very simple. You just need to tell the client to connect to ip address 127.0.0.1, which is local host. You also define the port number for the client. On Server side, you just need to listen to that port. Then run both client and server programs on the same PC and it should work.


How do you save the input from an HTML form to a notepad document?

You can't. You need a Server-side scripting language such as php.


How connectionless communication between a client and a server proceeds when using sockets?

Both the client and the server create a socket, but only the server binds the socket to a local endpoint. The server can then subsequently do a blocking readcall in which it waits for incoming data from any client. Likewise, after creating the socket, the client simply does a blocking call to write data to the server. There is no need to close a connection.


What is the difference between client side scripting and server side scripting languages?

Best Practice : Use both The Cons of using one or the other : With client side validation only, if a user disables JavaScript, then no validation will occur. With server side validation only, there are more return trips to the server which in turns uses more resources and slows down the site when a client side script could have done the validation without the server. The Pros of having both : The data will always be validated, whether or not the client has JavaScript enabled or not. There will be less server strain with the client side validation. The client can fix form errors faster with instant client side notifications. The data will have a bit more integrity going through the dual validation process.


What is an outdated client in Minecraft?

Client outdated means that the client (the software used to connect to the server) is out of date. You need to update your version of Minecraft.


Can you have PHP and PERL running on the same server and on the same website?

Yes, it is very easy to run PHP and Perl together on the same server, and even the same website. However, if you intend to use multiple applications written in different scripting languages, but have the potential for your site to eventually need complete integration, it is advisable to use applications written in only one scripting language.