Difference between revisions of "Client-side scripting"
Karl Jones (Talk | contribs) (fix and link) |
Karl Jones (Talk | contribs) (Fix) |
||
Line 47: | Line 47: | ||
== Server-side scripts == | == Server-side scripts == | ||
− | In contrast, [[Server-side scripting|server-side scripts]], written in languages such as [[PHP]], [[ASP.NET]], [[Java (programming language)|Java]], [[ColdFusion]], [[Perl]], [[Ruby (programming language|Ruby]], Go, [[Python (programming language)|Python]], and [[server-side JavaScript]], are executed by the [[web server]] when the user requests a document. | + | In contrast, [[Server-side scripting|server-side scripts]], written in languages such as [[PHP]], [[ASP.NET]], [[Java (programming language)|Java]], [[ColdFusion]], [[Perl]], [[Ruby (programming language)|Ruby]], Go, [[Python (programming language)|Python]], and [[server-side JavaScript]], are executed by the [[web server]] when the user requests a document. |
They produce output in a format understandable by [[Web browser|web browsers]] (usually [[HTML]]), which is then sent to the user's computer. | They produce output in a format understandable by [[Web browser|web browsers]] (usually [[HTML]]), which is then sent to the user's computer. |
Revision as of 06:33, 30 August 2015
Client-side scripting refers to the class of computer programs on the web that are executed client-side, by the user's web browser.
Contents
Dynamic HTML
This type of computer programming is an important part of the Dynamic HTML (DHTML) concept, enabling web pages to be scripted; that is, to have different and changing content depending on user input, environmental conditions (such as the time of day), or other variables.
Location of script
Client-side scripts are often embedded within an HTML or XHTML document (hence known as an "embedded script"), but they may also be contained in a separate file, to which the document (or documents) that use it make reference (hence known as an "external script").
Upon request, the necessary files are sent to the user's computer by the web server (or servers) on which they reside.
The user's web browser executes the script, then displays the document, including any visible output from the script.
Interactivity
Client-side scripts may also contain instructions for the browser to follow in response to certain user actions, (e.g., clicking a button).
Often, these instructions can be followed without further communication with the server.
Source code
By viewing the file that contains the script, users may be able to see its source code. Many web authors learn how to write client-side scripts partly by examining the source code for other authors' scripts.
Security restrictions
Due to security restrictions, client-side scripts may not be allowed to access the user's computer beyond the web browser application. Techniques like ActiveX controls can be used to sidestep this restriction.
Client-side scripting is not inherently unsafe. Users, though, are encouraged to always keep their web browsers up-to-date to avoid exposing their computer and data to new vulnerabilities.
User experience
The latest group of web browsers and web pages tend to employ a heavy amount of client-side scripting, accounting for an improved user interface in which the user does not experience the unfriendly "refreshing" of the web page, but instead sees perhaps an animated GIF file indicating that the request occurred and the page will be updated shortly.
Ajax
Ajax is an important addition to the JavaScript language, allowing web developers to communicate with the web server in the background without requiring a completely new version of the page to be requested and rendered. This leads to a much improved user experience in general.
Cross-browser issues
Even languages that are supported by a wide variety of browsers may not be implemented in precisely the same way across all browsers and operating systems.
Authors are well-advised to review the behavior of their client-side scripts on a variety of platforms before they put them into use.
See cross-browser and cross-platform.
Server-side scripts
In contrast, server-side scripts, written in languages such as PHP, ASP.NET, Java, ColdFusion, Perl, Ruby, Go, Python, and server-side JavaScript, are executed by the web server when the user requests a document.
They produce output in a format understandable by web browsers (usually HTML), which is then sent to the user's computer.
The user cannot see the script's source code (unless the author publishes the code separately), and may not even be aware that a script was executed.
Documents produced by server-side scripts may, in turn, contain client-side scripts.
See also
External links
- Client-side scripting @ Wikipedia