4

I am trying to understand what the main difference between hta and html files is. I googled it and I found this:

The main problem is that javascript is buggy. For example the javascript: protocol does not even exist. Hta seems to prefer VBscript modeled coding instead of the javascript model, such as <span style="cursor:hand" onclick=go()> instead of <a href="#" onclick=go()>. It's a windows exe so some cross-browser/cross-platform contructs of html are simply not supported or ill-supported. Also window resizing produces different dimensions.

I have some interactive plots (HTML5) generated by JavaScript codes. Are they gonna be functional if I transfer them to hta files?

Bergi
  • 513,640
  • 108
  • 821
  • 1,164
Hamid K
  • 825
  • 1
  • 13
  • 35

2 Answers2

3

If you don't add any special code, the answer is no.

Usually, HTML5 doesn't work in HTA files because they are run by mshta.exe which acts like IE7 and HTML5 isn't supported in earlier versions of IE than IE9. But if you add <meta http-equiv="x-ua-compatible" content="ie=edge" /> in the head of the HTA, the HTA will act like the version of IE installed on the computer, so if the computer has IE9 or later and you add that tag, it will work. The problem with this is that if you upgrade the HTA, the <hta:application/> tag won't have any effect so you will lose all effects like icons, window properties, etc. For this reason, I prefer to not upgrade the HTA and to use workarounds instead of HTML5.

Donald Duck
  • 6,488
  • 18
  • 59
  • 79
  • actually, it's possible to use `` and `` together. for this, you should put HTA tag and properties in one file (don't forget `NAVIGABLE="yes"` properties) and all other scripts and whole HTML file in a separate one, then join these two files with a `` in the below of `a.hta` tag – kia nasirzadeh May 27 '19 at 14:44
1

In HTA, to get the code to properly work, you must include the tag <meta http-equiv="x-ua-compatible" content="ie=edge" /> or <meta http-equiv="x-ua-compatible" content="ie=9">to get the JavaScript and HTML 5 to work completely. You may add

<HTA:APPLICATION
APPLICATIONNAME="HTA"
ID="HTA"
VERSION="1.0"
MAXIMIZEBUTTON="no"/>

Or some variant of that to get the HTA window to work properly. If you would post the code, Hamid K, that you are referring to, I would check it for you to more thoroughly answer the question.

Buzzchuck
  • 11
  • 2