WebReference.com logo
tip archive  •   about  •   sitemap  •   contact  •   jobs  •   write for us  •   subscribe


[next]

Rolling Out Your Own HTML Application Version Control

By

Social Bookmark

UNIX System Administrator - SUN Solaris, Veritas, EMC, Shell Scripting, SAN (NYC)
Next Step Systems
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume


During the last few weeks, we've been exploring the world of HTML Applications (HTAs), which are a Microsoft creation that promises to bridge the gap between traditional desktop applications and browser-based ones. In the last article, entitled "Mixing Scripting Languages", we saw how HTAs come with powerful capabilities that are not available to normal web pages, including database, file system, and even registry access! Now it's time to explore how to exploit some of these capabilities using VBScript. We'll be putting the rubber to the road as we roll out an HTML Application (HTA) version control strategy.

Checking for Updates

An advantage that web apps have over the traditional desktop variety is that they can check for newer versions periodically and offer automatic updates as new versions become available:

Figure 1

The downside is that many users find the popups annoying. For this reason, it's a good idea to include a setting in the options to disable the update checking feature:

Figure 2


Tracking the Version Number in the Page Source

The <HTA:APPLICATION> tag is where we can include information about the application and its presentation. One of the attributes is the VERSION. There are no formatting standards for this field, but it is assumed that you would assign a number which contains the major release number, a period, followed by the minor release number. Here I've ascribed a typical version number of "1.01". We will also be using the APPLICATIONNAME attribute to link the version number to the application. Both these fields will be inserted at the bottom of the page, using VBScript. We'll check for the latest version from the website in the Window_OnLoad() sub and insert a message in the Update <SPAN> based on the results. Here are the contents of the page without any scripting:

Paste the above code into a new text document and save it as "HTA Version Demo.hta". Double click the new file to launch the HTML app.

Figure 3

There are a couple of things that bear mentioning about the above HTA.

The gradation effect in the application background is provided courtesy of the Microsoft DXImage.Transform control. It is just one of many eye-catching effects that are compatible with the Microsoft Internet Explorer browser, and by extension, HTAs! A lot of web developers are not at all familiar with these amazing controls because they are not cross-browser compatible. Since browser compatibility is not an issue in HTAs, why not take advantage of these powerful effects to add some flair to your apps!

The other point of interest is the footer. It is a place holder for the application name and version number. Until we add some scripting to the page, it displays "Application Name" and "Version 0.00" for the time being.

VBScript Code

As always, the first line of code in your script should be Option Explicit, so that you are forced to explicitly declare all variables. We'll be needing four constants:

Only two can be declared as constants because VBScript, like the Visual Basic language, is very strict about constants in that they can only be assigned literal values. Therefore, unlike other languages like say Java, you cannot assign a variable or expression to a constant at run-time:


[next]

Recent Articles

WebReference.com site name
Use Web Caching to Make Your Web Site Faster
Creating an Online Shopping Cart Mechanism in PHP
Log JavaScript Errors Using an AJAX-driven Web Service
internet.com site name
Configuring Granular Settings for a Database Level Audit
The Perils of a Web 2.0 Transition on Your Business Processes
Facebook Redesigns Site —Again — Nears 400M Mark



The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers