Microsoft Windows Architecture for Developers Training Kit

Client-Side and Server-Side Scripting

Client-side script runs on the client computer. Web browsers contain scripting interpreters that can read and run the script.

The primary purpose of adding client-side script to a Web page is to create event procedures for controls. For example, you can write an event procedure that runs a function when a user clicks a particular button.

Client-side script is not compiled, nor is it encrypted on an HTML page. Therefore, if you view the HTML source of a Web page, you will see the script included in the page.

For a client-side script to function, a Web browser must support the scripting language. If it does not, the user will not have full access to the scripted features on the Web page.

Figure 9.1 How client-side and server-side scripting is used to develop Web applications

Server-Side Scripting

Server-side script runs in an Active Server Page on a Web server before the server returns the page to the user. When a user requests an Active Server Page, the server-side script runs and generates HTML to return to the user. Server-side script is not visible to the user on the returned Web page.

Because server-side script runs on a Web server, it has access to all resources, such as databases and executable files that reside on that server.

Server-side script requires a Web server that supports Active Server Pages. A Web browser does not need to provide any additional functionality for a server-side script to work. Therefore, server-side script runs regardless of which Web browser is used.

Common Tasks of Client and Server Script

When you use client-side script, processing occurs on the user's computer while the user interacts with the Web page.

Client-side script is useful for performing the following tasks:

When you use server-side script, processing occurs on the Web server before the page is returned to the user.

Server-side script is useful for performing the following tasks:

Категории