19

I want to convert a webpage html5/js page to a desktop application. Something they can use on their desktop without a live internet connection. (I do not want to recode my html5 or js.)

If the end user has Internet Explorer installed, I can easily port this to an hta file. However, what if they are using Vista or above and have uninstalled Internet Explorer (as you are permitted to do)? What if their main browser is Firefox or Chrome?

I was searching around for Firefox, and it seemed Prism was an alternative to hta files, but if you go to Mozilla's Prism page it says it is a technology that is no longer being pursued.

So I have several questions:

  1. Is the hta file still a modern technology for Internet Explorer which is still going to work in IE9, IE10?
  2. Will hta files, with no security issues or local access issues, automatically fire up Firefox/Chrome if IE is not installed on Windows (or other operating systems)?
  3. Can I add some of html5's local storage stuff to my hta file and will it still work on IE, FF and Chrome?
  4. If these things will not work on FF or Chrome, do they have any alternatives which are modern and are not deprecated techs?
BenMorel
  • 34,448
  • 50
  • 182
  • 322
Rewind
  • 2,554
  • 3
  • 30
  • 56
  • 2
    An HTA is IE only, no other browser will provide the additional features/elevated privileges they permit (if you don't need those features then you don't need an HTA) – Alex K. May 16 '12 at 13:56
  • Prism is a runtime environment, it won't remove the need for an internet connection. You should look at the [HTML5 Offline Spec](http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html) for Firefox and Chrome. – robertc May 16 '12 at 14:15
  • Also, Prism was really intended to be an open competitor for [Adobe AIR](http://www.adobe.com/products/air.html), so you may want to look into that. – robertc May 16 '12 at 14:17
  • You could try to create an MHTML file: http://en.wikipedia.org/wiki/MHTML – Tyilo May 16 '12 at 14:57
  • Thanks for the replies. Some questions: 1. I want something that feels like a desktop app, so why dont I need hta? 2. @robertc Would an offline html5 save to the desktop or start menu? 3. Adobe AIR would require a plugin, which I am trying to avoid. – Rewind May 16 '12 at 17:11
  • 1. I don't know what .hta is, I use Linux - will it work on that? 2. There's stuff in train for that, but currently no. 3. Why is installing an entire application better than installing a plugin? – robertc May 16 '12 at 17:55
  • 1
    You mentioned that you don't want to rewrite your HTML, so presumably this is going to feel like a web app regardless. The main reason for developing an HTA is native app priveleges (like the file system), not the lack of a bookmarks bar. If you have an existing working web app, and want people to be able to use it when they are offline, then the "offline spec" that robertc linked above (also sometimes called "application cache") is specifically designed for the exact problem that you are describing. Another link: http://www.html5rocks.com/en/tutorials/offline/whats-offline/ – GrandOpener Apr 07 '13 at 07:53

7 Answers7

16

Actually HTAs are not run by Internet Explorer. They are run by mshta.exe, which is installed in Windows/System32 (Windows7). However, HTAs use IE's rendering engine, and can't be run without IE. Also they are available for Windows users only.

HTML5 support can be added by using <meta http-equiv="x-ua-compatible" content="ie=9">. By my own experience also <!DOCTYPE html> is needed.

More info in MSDN: Introduction to HTAs

In SO: HTA's; use other browser to host?

Community
  • 1
  • 1
Teemu
  • 22,918
  • 7
  • 53
  • 106
  • Thanks - this has perfectly answered my question for the Windows environment. I will leave the question unanswered for another day or two to see if anyone can answer for the non-Windows environment. – Rewind May 17 '12 at 18:41
  • 1
    I just wanted to note that putting IE-conditional comments around and maybe other tags (to add custom classes to work around IE7/8 quirks in my CSS) can prevent the page from being displayed in HTML5 mode even if the correct doctype and x-ua-compatible meta tag is specified. Took me a while to figure that one out.This also goes for the X-UA-Compatible tag - you can't wrap this inside a conditional comment to make your HTML 'clean' for other browsers. – aphax Jul 10 '12 at 16:22
  • @aphax Thanks for your comment. Every day is for learning... This might be valuable information for Jon Ashman too, if he decides to use HTA's. – Teemu Jul 10 '12 at 16:50
  • HTAs require Trident, IE's layout engine, but I seriously doubt that HTAs require Internet Explorer itself. Trident is integral to the Operating System and cannot be removed, even if the browser is uninstalled. I plan to decommission a laptop later this month. Once I'm done, I'll uninstall IE and then test an HTA and report back. – gilly3 Apr 14 '13 at 03:45
  • @gilly3 Any succeed with a test without IE? It would be interesting to see some results. – Teemu Nov 28 '13 at 18:58
  • I realize this is 8 years later, but there was no report back so... If Internet Explorer is removed from Windows 10, HTA files continue to work without issue. HTAs also continue to work fine on Windows 11. In both cases, the Trident (MSHTML) browser engine remains intact. Of course, any script that uses "InternetExplorer.application" or "window.open" will no longer work. Windows 10 IE 11 Removal Steps: Control Panel, Programs and Features, Turn Windows features on or off, uncheck Internet Explorer 11, and restart. – LesFerch Jul 30 '21 at 00:42
  • @LesFerch Yes, that's possible. Trident is the keyword, its objects are remaining when IE web browser is uninstalled. Removing Trident would probably stroke Windows. – Teemu Aug 01 '21 at 11:23
  • The statement '... it can't be run without IE' is wrong. Refer to the [Wikipedia page](https://en.wikipedia.org/wiki/HTML_Application): HTAs are dependent on the Trident (MSHTML) browser engine, used by Internet Explorer, but are not dependent on the Internet Explorer application itself. If a user removes Internet Explorer from Windows, via the Control Panel, the MSHTML engine remains and HTAs continue to work. HTAs continue to work in Windows 11 as well. – s.ouchene Sep 14 '21 at 06:56
9

I'd say that .hta applications are way out of date since they don't support modern design standards. you can still use them or use another HTML Compilers like the one by David Esperalta, it's good enough for very simple apps, but they all depend on IE and we all know how limited and slow it is.

Modern Alternatives:

  • NW.js (previously known as node-webkit)
  • electron which I personally use and recommend.

both mentioned options are based on Chromium (same as Chrome), Node.js and V8. they support HTML5, CSS3 and latest JavaScript engine including latest ECMAScript features and beyond!

and since they use node.js you can use any of its built-in libraries (like FileSystem) or any of npm packages right in your DOM!

The npm registry hosts over a quarter million packages of reusable code — the largest code registry in the world.

both options are FREE and open sourced but electron supports ffmpeg codecs without downloading or building them.

  • both options now support ffmpeg out of the bag.

your app will be 100% standalone and you can build same app for Windows, macOS and Linux.

electron can also provide simple solutions to automatically compile and use CoffeeScript, Babel, LESS, SASS and more.

Downsides:

• You'll always have to ship the whole thing with you application since there's no run-time solution and you'll end up with a relatively big package.

• startup time is less than ideal for some applications

• although there is some methods to make it harder but your code will be available for anyone with an idea of what they are doing.


2021 Update

electron and nwjs are just as viable as ever but if you're looking for a more lightweight UI I'd also recommend Sciter.JS it made big leaps in recent updates and it does not ship a whole browser with your application, the developer seems committed to follow up-to-date HTML/CSS/JS Standards with some nice additions. it comes with good collections of samples to get you started. and prebuilt binaries for major OS editions. one thing to note is that it uses QuickJS instead of Node.js if that matters to you.

I've been following its development closely and I recommend trying it.

Maher Fattouh
  • 1,742
  • 16
  • 24
3

1.Is the hta file still a modern technology for Internet Explorer which is still going to work in IE9, IE10?

Most likely yes. The underlying technology is based on embedding the IE browser control as an activex object. Even if mshta was no longer distributed with windows a replica could still be created using c# and the browser control.

2.Will hta files, with no security issues or local access issues, automatically fire up Firefox/Chrome if IE is not installed on Windows (or other operating systems)?

Nope, although the .hta extension can be associated with those browsers, the mshta directives are not supported by either - the result is that the browser prompts you to save the document as an external file like an exe or zip file would.

3.Can I add some of html5's local storage stuff to my hta file and will it still work on IE, FF and Chrome?

Yes you can add html5 support, but again it will only work on IE.

4.If these things will not work on FF or Chrome, do they have any alternatives which are modern and are not deprecated techs?

Adobe produced a competing product called Adobe AIR - http://www.adobe.com/products/air.html. This product offers a limited intersection of features available in hta's. Local file access is restricted to a specific path, and generally access to the parent operating system is very restricted. However they do operate across all major platforms, including mobile devices, so they are probably the technology you are looking for. AIR uses webkit for the embedded browser engine.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Marcus Pope
  • 2,293
  • 20
  • 25
3

I wouldn't try to use a .HTA file, I would use Node-Webkit. Node-Webkit will let you do the same things as .HTA files will, but Node-Webkit seems to be faster and it is better supported. https://github.com/rogerwang/node-webkit; https://github.com/rogerwang/node-webkit/wiki/Manifest-format. Also, with Node-Webkit you can use node.js and easily make your program cross-platform too.

JohnDoe
  • 235
  • 2
  • 11
1

Yes, .hta is a deprecated functionality and only works on windows machines. However, as far as I have been able to determine it is also the only option that provides OS functional integration, doesn't require a webserver, gives full control over the app window look/feel/placement, and the last time I checked (which admittedly was over 2 years ago) still worked in windows 10.

Ronshak
  • 11
  • 1
0

Plz look into electron it's based on v8

http://electron.atom.io

aWebDeveloper
  • 36,687
  • 39
  • 170
  • 242
0

An update for this old, but still relevant question.

mhtml / mht, "MIME HTML" might be a simple solution. From: https://whatis.techtarget.com/fileformat/MHTML-MHTML-document-MIME

MHTML (short for MIME HTML) is a file extension for a Web page archive file format as saved by Internet Explorer. The archived Web page is an MHTML document. MHTML saves the Web page content and incorporates external resources, such as images, applets, Flash animations and so on, into HTML documents.

At the time of writing, I have tested native support for the following browsers:

  • YES Chrome 81.0.4044.138
  • YES Opera 68.0.3618.104
  • NO Firefox 76.0.1
  • NO Safari Version 13.1 (15609.1.20.111.8)

Chrome has added, removed and re-added support for mhtml in the last year, so an investment there is shaky. Safari has native support for MAFF, but not mhtml Firefox can support mhtml via plugin. Other browsers not tested, but MSIE had has support for it.