HTML Application
Encyclopedia
An HTML Application is a Microsoft Windows
program whose source code consists of HTML
, Dynamic HTML
, and one or more scripting languages supported by Internet Explorer, such as VBScript
or JScript
. The HTML is used to generate the user interface, and the scripting language is used for the program logic. An HTA executes without the constraints of the internet browser security model; in fact, it executes as a "fully trusted" application.
The usual file extension of an HTA is
The ability to execute HTAs was introduced to Microsoft Windows in 1999, along with the release of Microsoft Internet Explorer 5.
. In general, HTA's are said to be suitable for many purposes, from prototypes to "full-scale" applications, especially where flexibility and speed of development are critical.
An HTA is treated like any executable file with extension
. When executed via mshta.exe (or the file icon is double-clicked), it runs immediately. When executed via the browser, the user is asked once, before the HTA is downloaded, whether or not to save or run the application; if saved, it can simply be run on demand after that.
, that is, it is confined to communicating with the server, manipulating the page's object model
(usually to validate forms and/or create interesting visual effects) and reading or writing cookies
.
On the other hand, an HTA runs as a fully trusted application and therefore has more privileges than a normal HTML file; for example, an HTA can create, edit and remove files and registry
entries. Although HTAs run in this 'trusted' environment, querying Active Directory
can be subject to Internet Explorer Zone logic and associated error messages.
Otherwise, an HTA has the same format as an HTML page.
An existing HTML file (with file extension
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
program whose source code consists of HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
, Dynamic HTML
Dynamic HTML
Dynamic HTML, or DHTML, is an umbrella term for a collection of technologies used together to create interactive and animated web sites by using a combination of a static markup language , a client-side scripting language , a presentation definition language , and the Document Object Model.DHTML...
, and one or more scripting languages supported by Internet Explorer, such as VBScript
VBScript
VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...
or JScript
JScript
JScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...
. The HTML is used to generate the user interface, and the scripting language is used for the program logic. An HTA executes without the constraints of the internet browser security model; in fact, it executes as a "fully trusted" application.
The usual file extension of an HTA is
.hta
.The ability to execute HTAs was introduced to Microsoft Windows in 1999, along with the release of Microsoft Internet Explorer 5.
Uses
HTAs give the developer the features of HTML together with the advantages of scripting languages. They are popular with Microsoft system administrators who use them for system administration tasks, such as user-forms and pre-written network queries, since, for example, VBScript and JScript can access the Windows Task ManagerWindows Task Manager
Windows Task Manager is a task manager application included with the Microsoft Windows NT family of operating systems that provides detailed information about computer performance and running applications, processes and CPU usage, commit charge and memory information, network activity and...
. In general, HTA's are said to be suitable for many purposes, from prototypes to "full-scale" applications, especially where flexibility and speed of development are critical.
Execution
An HTA is executed using the programmshta.exe
, or, alternatively, double-clicking on the file. This program is typically installed when Internet Explorer is installed. mshta.exe
executes the HTA by instantiating the Internet Explorer rendering engine (mshtml) as well as any required language engines (such as vbscript.dll).An HTA is treated like any executable file with extension
.exe
EXE
EXE is the common filename extension denoting an executable file in the DOS, OpenVMS, Microsoft Windows, Symbian, and OS/2 operating systems....
. When executed via mshta.exe (or the file icon is double-clicked), it runs immediately. When executed via the browser, the user is asked once, before the HTA is downloaded, whether or not to save or run the application; if saved, it can simply be run on demand after that.
Security considerations
When a regular HTML file is executed, the execution is confined to the security model of the web browserWeb browser
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. An information resource is identified by a Uniform Resource Identifier and may be a web page, image, video, or other piece of content...
, that is, it is confined to communicating with the server, manipulating the page's object model
Object model
In computing, object model has two related but distinct meanings:# The properties of objects in general in a specific computer programming language, technology, notation or methodology that uses them. For example, the Java objects model, the COM object model, or the object model of OMT...
(usually to validate forms and/or create interesting visual effects) and reading or writing cookies
HTTP cookie
A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is used for an origin website to send state information to a user's browser and for the browser to return the state information to the origin site...
.
On the other hand, an HTA runs as a fully trusted application and therefore has more privileges than a normal HTML file; for example, an HTA can create, edit and remove files and registry
Windows registry
The Windows Registry is a hierarchical database that stores configuration settings and options on Microsoft Windows operating systems. It contains settings for low-level operating system components as well as the applications running on the platform: the kernel, device drivers, services, SAM, user...
entries. Although HTAs run in this 'trusted' environment, querying Active Directory
Active Directory
Active Directory is a directory service created by Microsoft for Windows domain networks. It is included in most Windows Server operating systems. Server computers on which Active Directory is running are called domain controllers....
can be subject to Internet Explorer Zone logic and associated error messages.
Functionality
To customize the appearance of an HTA, a new (optional) taghta:application
was introduced to the HEAD
section. This tag exposes a set of attributes that enable control of border style, the program icon, etc., and provide information such as the argument (commandline) used to launch the HTA. Otherwise, an HTA has the same format as an HTML page.
Development Tools
Any text editor can be used to create an HTA. Editors with special features for developing HTML applications may be obtained from Microsoft or from third-party sources.An existing HTML file (with file extension
.htm
or .html
, for example) can be changed to an HTA by simply changing the extension to .hta
.Example
This is an example of Hello World as an HTML Application.See also
- Active ScriptingActive ScriptingActive Scripting is the technology used in Windows to implement component-based scripting support. It is based on COM and allows installation of additional scripting engines in the form of COM modules.-Uses and history:The Active Scripting technologies were first released in 1996, with the...
- JScriptJScriptJScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...
- VBScriptVBScriptVBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...
- XULXULIn computer programming, XUL , the XML User Interface Language, is an XML user interface markup language developed by the Mozilla project. XUL operates in Mozilla cross-platform applications such as Firefox...
and XULRunnerXULRunnerXULRunner is a runtime environment developed by the Mozilla Foundation to provide a common back-end for XUL-based applications. It replaced the Gecko Runtime Environment, a stalled project with a similar purpose....
- a language and environment for Mozilla cross-platform applications that resemble the mechanism of HTML Applications
External links
- HTML Component (HTC) Reference at MSDN. An HTC encapsulates specific functionality or behavior within HTAs.
- The Script Center, The Script Center, home of Hey, Scripting Guy! Blog
- Learn About Scripting for HTML Applications (HTAs), a tutorial site for learning about HTA's