Back to the Future: Microsoft HTML Applications


A couple people emailed me today to tell me that the Windows Scripting Host stuff is still alive and kicking in response to my thought that FireFox should come with a Javascript command line interface. I knew that, actually, but I couldn't get it to do anything too exciting the last time I tried it. But after I got those emails, I decided to take a look at it again, and though I was able to get an XMLHttpRequest to pull down some data from a URL, I wasn't able to figure out how to actually prompt me for some info - like for a phone number. My thought was "hey, wouldn't it be cool if I could take the same sort of Send To Phone bookmarklet I made for FireFox and put it down in the Quick Launch area next to the Start button?" But the lack of an input prompt got me stuck.

So while I was roaming around MSDN site looking for ways to pop up a dialog in a WSH JavaScript, I ran across a bunch of stuff I remember messing with back in 1999 - including HTML Applications contained in an .hta file. Ahh, that's right - that's how you can make apps using the scripting stuff. By using an .hta file, you're essentially making an html page which runs without a sandbox, and can call local COM objects and such. I remember when I first saw that stuff years ago, it didn't seem all that exciting, but a lot of stuff has changed since thing. Ajax techniques (pioneered by Microsoft, one has to admit) has made HTML into a richer GUI environment. The Single Page Applications I was raving about the other day show that HTML apps don't have to be tied to a server either, and that's basically what .hta apps are.

Playing with TiddlyWiki in my browser the other day blew my mind because it was saving things to my computer, even though I didn't have a web server or database running locally. That's the first time I've ever seen that and it hurt my brain! I've gotten used to my browser making calls to the network and back, having an app not do that was nutty. But after reading up on the HTA stuff again, I thought - hey, this would be perfect for TiddlyWiki - and within 2 minutes, I had the "app" running with it's own spot in my task-bar and ability to save and everything. All that separates an .hta file from a normal .html file is the file extension (obviously) and an hta:application tag you put in the header. That's it. So I just "made" a few apps from stuff online - TiddlyWiki is the only real client-only app, the other two are just wrappers around normal web pages... but they're all pretty neat to play with.

Want to try them out? You have to be running Windows (I think 2000 or XP), and the browser may freak out because .hta is a great source of viruses as well. But here they are: TiddlyWiki HTA, Grazr HTA, and Yahoo! Mobile HTA. Again, all I did was make these self-contained, TiddlyWiki and Grazr are owned by their respective authors, and the Y! Mobile page simply just calls out to the web page with a line of Javascript - you could do the same with a normal HTML page and some Javascript to get rid of the headers, etc. But it's sort of a fun little thing to have in your task bar... kinda like a Widget.

So there's lots of interesting things you can do with this, no? All those next-gen Calendaring apps, for example? Imagine if instead of always having to be online, you can use this sort of thing offline and be able to sync when you're connected later. Lots of stuff like that comes to mind. Though there are definite limitations without signed apps - I quickly discovered that trying to use the XMLHTTPRequest object with a dynamic URL prompts the user every time, which is defniitely annoying. And, hey, if you didn't know, I also discovered that Microsoft has a patent on the HTML Desktop app already. Isn't that nice?

Anyways, I looked at the XUL stuff again to see if there was an easy way to do the same sort of thing with some sort of simple XML wrapper around HTML, but it doesn't look that way... well, to me "simple" means I would have found it in the 10 minutes I spent looking, so there could be a way, I just don't know of it right now. And again, the similarity to Widgets is interesting as well... I guess if I *really* wanted a platform to mess with, Yahoo! Widgets use XML and JavaScript, and are cross platform. Opera's new Widget Platform is also that way, and based on XHTML as well... But there's something nice about the idea of a desktop app which has the platform already installed, no? Years of dealing with JVM headaches has made me a bit squeemish about messing with Yet Another Runtime Platform...

Ok, so that was my break for this evening... I still would like a way of just executing arbitrary JavaScript from my tool bar as a full scripting language, like PHP CLI or Perl, without having to mess around installing anything else since I've got not one, but two huge JavaScript engines installed already (3 if you count Flash). And I doubt I'm going to start getting all cozy with Microsoft scripting - as the worse thing about the .hta apps is they're using IE... bleh - click on an outside link and you get a big E circling. No thanks!


< Previous         Next >