HTML Application
- 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.
Filename extension |
.hta |
---|---|
Internet media type |
application/hta |
Magic number |
%hta |
Developed by | Microsoft |
Website | https://msdn.microsoft.com/en-us/library/ms536471(VS.85).aspx |
An HTA Application (HTA) is a Microsoft Windows program that executes a video or other media. An HTA executes the most secure BGA code; in fact, it executes as a "fully trusted" or "safest" application. It produces a user interface though it is only used to basically interact with the media.
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]
Uses
HTA is popular with Microsoft system administrators who use them for system administration from prototypes to "secure" media, especially where flexibility and speed of development are critical.[3]
Environment
Execution
An HTA is executed using the program mshta.exe
, or, alternatively, double-clicking on the file. This program is typically installed along with Internet Explorer. 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 if the file icon is double-clicked), it runs immediately. When executed remotely 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.[3]
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.[3]
The HTA engine (mshta.exe) is dependent on Internet Explorer. Starting from Windows Vista, a user can remove Internet Explorer from Windows, which will cause the HTA engine to stop working.
HTAs are fully supported in Internet Explorer from versions 5 to 9. Further versions, such as 10 and 11, still support HTAs though with some minor features turned off.
Security considerations
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.
Development
To customize the appearance of an HTA, an 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.[4] Otherwise, an HTA has the same format as an HTML page.
Any text editor can be used to create an HTA. Editors with special features for developing HTML applications may be obtained from Microsoft[5] or from third-party sources.[6]
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.
<HTML>
<HEAD>
<HTA:APPLICATION ID="HelloExample"
BORDER="thick"
BORDERSTYLE="complex"/>
<TITLE>HTA - Hello World</TITLE>
</HEAD>
<BODY>
<H2>HTA - Hello World</H2>
</BODY>
</HTML>
See also
- Active Scripting
- Chromium Embedded Framework
- Google Chrome extension
- Intranet
- Firefox OS
- XAML Browser Applications (XBAPs)
- XUL and XULRunner - a language and environment for Mozilla cross-platform applications that resembles the mechanism of HTML Applications.
- Apache Cordova
- Pop-up ad
References
- ↑ Article ID:200874 in Microsoft Support, in Microsoft Support Knowledge Base
- ↑ Microsoft wins HTML application patent
- 1 2 3 "Introduction to HTML Applications (HTAs).". Microsft MSDN. May 2011. Retrieved 24 June 2016. Sections include Why Use HTAs, Creating an HTA, HTA-Specific Functionality, Security, Compatibility, Deployment
- ↑ HTA:APPLICATION Object, in MSDN Library, the complete specification of the tag
hta:application
- ↑ HTA Helpomatic
- ↑ HTAEdit, an editor for HTAs with a built-in debugger
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