HTA Application ~ Basics
 
An HTA or HTML Application is HTML code with a .hta file extension. It's a trusted application that uses mshta.exe to display the Internet Explorer object without the security restrictions of the browser. Coding, using any of many scripting languages, allows access to the file system, the registry, remote access to other computers on a network, and much more.

The key phrase above is "Internet Explorer object" and the Windows file mshta.exe is needed to launch files with the hta file extension. This article assumes that you know basic HTML and Javascript.

To demonstrate that mshta.exe will open a file that has no HTML, create a new empty text file, called it simple.hta and launch it by double-clicking on it. Mshta.exe opens the file without issue.

Now copy the following code into simple.hta, save it and launch it.

<html>
<head>
<HTA:APPLICATION
  APPLICATIONNAME="Simple HTA"
  SYSMENU="yes">
<title>Simple HTA</title>
</head>
<body>
<p>This Simple HTA does nothing.</p>
</body>
</html>

An HTA has an HTA Application Object tag in the head section of the script. I've used a couple of the object's properties, but none are required. Search on "hta object properties" for more information. Add the following CSS styles just beneath the title tags and now you have something that begins to resemble a web page. I've included the CSS styles to show that it's possible.

<style type="text/css">
  body {background-color:lightsteelblue;}
  p {font:bold 18px arial;}
</style>

To make things more interesting, see what happens when you insert the following between the two closing tags (</style> and </head>). We'll be building on the Javascript as we continue.

<script language="javascript" type="text/javascript">
  window.resizeTo(640,480);
</script>