There is a technical distinction between HTML scripts and other types of compiled applications or interactive elements that can be used on a website. The script usually is written in a human-readable scripting language and then embedded in an HTML document in some way. Alternately, a web-based application usually is written in a language that requires the code to be compiled in machine code or bytecode that then is executed by a standalone interpreter on the user’s system. Scripts generally are executed by the web browser or a plug-in for the web browser.
Another difference is that HTML scripts tend to be less full-featured than compiled programming languages, relying more on the base functionality of the web browser and HTML for some internal aspects. This makes a script easier and safer to execute in a browser, but also can restrict performance and other features, such as file and hardware access. Some client-side scripts only partially execute inside the web browser, instead contacting the web server to complete execution through other methods. This technique frequently is used for secure or proprietary processing of information, as can be the case on an e-commerce website.
In most instances, HTML scripts are used to access components of a website through the web browser. This allows access to the rendering canvas where the site is drawn, variables such as the background color of a page, or even user events such as mouse movements or button clicks. Complex HTML scripting languages have a structured or object-oriented syntax, allowing the creation of complete applications such as games or word processors. Other times, HTML scripts are used to process data from HTML forms so inputted values are range-checked, converted to other types of data or even formatted for output to a server.