HTML Application

From Wikipedia, the free encyclopedia
Jump to: navigation, search
This article refers to Microsoft's proprietary HTA implementation. For information regarding the HTML5 Cache Manifest, also referred to as offline HTML applications, please see Cache manifest in HTML5.
HTML Application (HTA)
Filename extension .hta
Magic number %hta
Developed by Microsoft

An HTML Application (HTA) 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 .hta.

The ability to execute HTAs was introduced to Microsoft Windows in 1999, along with the release of Microsoft Internet Explorer 5.[1] On December 9, 2003 this technology was patented.[2]


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 from prototypes to "full-scale" applications, especially where flexibility and speed of development are critical.[3]

HTA is also a way of developing offline application. Such offline application usually includes a master HTA file, and bunch of html / js /css files.


Beside the advantage of programming applications in Internet environment programming languages, which can usually be easier, due to the use of markup languages to build a UI (like XAML, which was later presented by Microsoft as a part of WPF), there are a few disadvantages of the current standard of HTA:

  • Only the main page of the project has the extension HTA, which means that only it can be modified with the properties of a GUI form.
  • Opening new windows can be done only by JavaScript (and it might open it using the web browser). Linking to another page will open it in the same window.
  • The engine of HTA files (mshta.exe) is completely dependent on Internet Explorer. In Windows Vista, for the first time, the user can remove Internet Explorer from Windows, which will cause a serious bug for the engine of HTA files.
  • Using server-side scripting languages isn't a built-in option, and can only be done by running a local server at the moment the HTA file is opened.
  • HTA files can't be compiled. The only solution that was found for that is to compress all of the files of the project to an SFX package. Another disadvantage of compiling an HTA is the fact that files inside the project can't be modified (modifying files usually can be done by server-side scripting languages, although the HTA engine has a permission to write files).
  • HTA files are only correctly supported by IE6 to IE9 with their handful <HTA:Application> tag. As Microsoft has officially stopped their support for HTAs, these applications might never become HTML5 compliant.
  • At the time of 2015, HTA is still being supported in IE11 with some minor features turned off. When people start a new project with HTA, it's important to find out whether if Microsoft will dump it in the coming IE versions.



Screenshot of an example window produced by mshta.exe

An HTA is executed using the program mshta.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. 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.[4]

By default, HTAs are rendered as per "standards-mode content in IE7 Standards mode and quirks mode content in IE5 (Quirks) mode", but this can be altered using X-UA-Compatible headers.[5]

Security considerations[edit]

Main article: Browser security

When a regular HTML file is executed, the execution is confined to the security model of the web browser, 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.


To customize the appearance of an HTA, a new (optional) tag hta: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.[6]

Otherwise, an HTA has the same format as an HTML page.

Development tools[edit]

Any text editor can be used to create an HTA. Editors with special features for developing HTML applications may be obtained from Microsoft[7] or from third-party sources.[8]

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.


This is an example of Hello World as an HTML Application.

<TITLE>HTA - Hello World</TITLE>
<H2>HTA - Hello World</H2>

See also[edit]


  1. ^ Article ID:200874 in Microsoft Support, in Microsoft Support Knowledge Base
  2. ^ Microsoft wins HTML application patent
  3. ^ Introduction to HTML Applications (HTAs), in MSDN Library
  4. ^ Why Use HTAs, in MSDN Library, Introduction to HTML Applications
  5. ^ [1] Introduction to HTML Applications (HTAs) - Compatibility
  6. ^ HTA:APPLICATION Object, in MSDN Library, the complete specification of the tag hta:application
  7. ^ HTA Helpomatic
  8. ^ HTAEdit, an editor for HTAs with a built-in debugger

External links[edit]