GuidesIE5's HTML Applications

IE5’s HTML Applications



Before now, if you wanted to create your own Windows application, you would have to go out and learn a programming language like C++ or Microsoft Visual Basic. Well, not anymore. With Microsoft’s latest Web browser, Internet Explorer 5, they’ve given developers the power to create their own applications using technologies and languages they already know, such as DHTML, HTML, CSS, and scripting languages.

HTML Applications (HTAs), as they’re called, have all the power of IE5 without the browser interface, and since they are executed directly they don’t have the same security constraints as Web pages. Once saved on the client machine, they simply runs like any other executable (.exe) program. This means that the HTAs can read and write files on the client machine or run embedded ActiveX controls and Java applets regardless of any security zone settings.

Just how easy is it?

It’s easy, let me tell you. We’ll start by creating the mandatory “Hello World” program to announce ourselves to the planet. Before continuing, you’ll need to make sure you have Internet Explorer 5 installed on your system. So if you don’t yet, head on over to microsoft.com and download it. It’s a great browser, and it’s free.

Hello World
View Source Code  Run Program

Are you ready now? Great, let’s get started. Create a new file called

hello.hta
and type in the following text.


Hello World

Now save it and double-click on the file. If everything went well, you’ll see a window pop open with the text ‘Hello World’ in it. Almost seems a little too easy, didn’t it?

What just happened there?

Windows knows right away that you want to run an HTML Application based on the file extension (.hta); and because we didn’t specify any window attributes, it just opened a standard window with the default settings and displayed the text we entered much in the same way that Internet Explorer would display a Web page.

You can customize the look and feel of the application window as well as it’s behavior by inserting an “HTA:APPLICATION” tag in the HEAD of your document. This tag lets you specify a number of window attributes from the window border style to the program icon displayed.

Let’s try something a little more advanced. Create a new file called

hello2.hta
and type in the following text.


Hello World 2

Hello World 2


Hello World 2
View Source Code  Run Program

We’ve added our own program icon and specified the different window attributes so you can see what’s available. You can change the border width to be thin or thick, or remove the border altogether, control which icon is displayed by the program and whether or not the maximize and minimize buttons are available. For a full list of attributes and their descriptions take a look at our:

Quick Reference Guide

 Property  Description
 applicationName This is the name of the application. This value is checked by the singleInstance property before attempting to launch another instance of the application.
 border Defines the windows outside border.

Values:
“Thick” – thick border w/ sizing grips
“Thin” – thin border, no sizing grips
“None” – no border

 borderStyle Defines the windows inside border (content border).

Values:
“Normal” – normal border style
“static” – 3D border style
“raised” – raised 3D border
“sunken” – sunken 3D border
“complex” – combo raised/sunken border

 caption Display title bar. Values: “yes” or “no”
 commandLine Returns the path and arguments from the command line that was used to launch the application. Returns empty string when launched over HTTP.
 icon Specify the path of program icon to use
 maximizeButton Display maximize button. Values: “yes” or “no”
 minimizeButton Display minimize button. Values: “yes” or “no”
 showInTaskBar Show program in taskbar. Values: “yes” or “no”
 singleInstance Defined whether only one instance of an application can run at a time. Values: “yes” or “no”
 sysMenu Display program icon. Values: “yes” or “no”
 version Program version number
 windowState Defines the window state when the application launches.

Values:
“normal” – same size as new IE5 windows
“minimize” – window minimized
“maximize” – window maximized

A world of possibilities

HTAs offer a world of possibilities for next-generation Web (and non-Web) applications and tools. In any case, for everything from WebCDs to intranets to prototyping, the future of HTAs definitely looks bright.

Dave Edis is the president of Edis Digital Inc., a new media software company that specializes in developing custom Web-based applications and publishing tools.


Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories