Web Design
Mobile Internet
Brand Design
Innovative
News
Encyclopedias

Script running platform

Date:2015-06-27 Source: Shangpin China Type: website encyclopedia
Word Size: small   medium   big

1、 Run script on client

You can run scripts on both the client side and the server side, and it is easy to distinguish the completely different operations of client script and server script. Client script is a script program running on the client. Its running environment is the Web browser of the client; The server-side script is a script program running on the server computer in the Web server software environment. The answer to the question of whether to run the script on the client or the server is different for each script, Website construction It also depends on some basic factors. Most of the programs written so far may have an implicit assumption that every line of code in the program runs on the same computer. If the script is run on two different computers, the Web application cannot be implemented on a single processor. No doubt, multiple processors can complete the task of the program at the same time, which will bring higher efficiency.

 
 Script Run

So what determines which computer runs a particular script? One of the main principles is that if the script can be run in the client, it should be completed by the client. Because both the client computer and the server have to pay for the calculation performed on the Web server. On the other hand, if the computing task is completed on the client computer, the client and server need not spend too much. Based on this economic consideration, every task that can be downloaded to the client computer for completion should be completed by the client.

For example, in the authentication example, the verification of whether the person filled in the form conforms to the restriction rules is completed before the data in the form is sent to the server. It can be imagined that if 100 users submit the information filled in the form to the server at the same time, if they are not on the client side but on the server side, the computing time scattered on 100 client computers will be much less. Both the client and the server side are willing to adopt this method. If a task can only be completed on the client side, it must be completed by client script. This principle is obvious. Generally speaking, scripts that can only be completed on the client side refer to those scripts that use intrinsic objects that only exist in the client browser. For example, the object used to control the window or document viewed by the user. Other scripts may run on both the client side and the server side, so you can follow this principle to decide where to run the script.

2、 Running scripts on the server side

To complete a task using the server script, consider how to make the Web application respond as quickly as possible. The Internet connection between the client and server computers is usually a narrow channel. If using client script to complete a task means that the channel is filled with a lot of data, but only saves a little computing time of Web_Server, the response speed of Web applications will be very slow. For example, when it is necessary to collect information from a large database, Although the client script can also operate a database and collect information, it is better to use the server script, because only the critical and necessary information can be transmitted to the client through the HTTP connection.

If a task can only be completed on the server side, the server script must be used to complete it. If a task requires built-in objects, the task can only be completed on the server side, because built-in objects only exist on the server side. A built-in object that only exists in the server environment, such as a Session object, is a data object that can store information about a user session (II. ion). As long as you are still using a page in your Web application, you can permanently retain this information. For example, you can use the Session II object to provide users with a feature similar to the "shopping cart". If the Web application provides a shopping place to the client. Save the Session object on Service 3. At some time, the client can get a special page that lists all the selected objects. There are also security considerations when using server-side scripts. Sometimes, you may not want to disclose script code. If you embed client script in HT-ML documents, all visitors can see it, while using server-side script, you can use those scripts that need to be kept confidential as server-side scripts; Stored on the web server.

In addition, sometimes the script code may contain key information about the Web application. If someone steals this information, it may attack the Web site. For example, if the computer name and database name of the credit card database are disclosed, the database server will become an obvious target of external attacks, and the blade 9 is very dangerous. Any client-side script can be viewed and analyzed by others, and server-side script is safe enough in this regard. The final factor in considering where to run the script is the difficulty of the task. Generally, the client system is much smaller and slower than the server system. Therefore, when using client script, consider whether the task can be completed by the client system in a tolerable time. For example, it is better not to let the client end system complete the task that can only be completed using complex AI technology, because this task is likely to slow the running speed of the client computer, and will not affect the server

The script used to complete a complex task may contain a large amount of code, which means that a large amount of additional text code will be transmitted to the client through the Internet.


Please contact our consultant

+86 10-60259772

Please provide your contact number. The project manager of shangpin China will contact you as soon as possible.