1

I am making a hta app for a home project and I would like to use javascript classes. Is this possible? If a use the basic example I find on google it gives a syntax error in hta. works as a html though. Also for my project I have to use hta as the UI and cant install anything.

<html>
    <head>  
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <script>            
            resizeTo( 235, 246 );
            moveTo( screen.width/2-210, screen.height/2-250 );

            class Rectangle {
              constructor(height, width) {
                this.height = height;
                this.width = width;
                }
            }
        </script>
        <title>toolset</title>      
    </head>
    <body>
        <div>some ui stuff</div>
    </body>
</html>
user692942
  • 16,398
  • 7
  • 76
  • 175
tokageKitayama
  • 551
  • 1
  • 4
  • 5
  • 2
    Microsoft HTAs use a proprietary version of JavaScript based off ECMAScript Version 3 called JScript. The engine was never updated so you can only use features available in ECMAScript Version 3 and below. Modern JavaScript syntax will fail. – user692942 Oct 30 '22 at 08:33
  • HTA is very outdated, [electronjs](https://www.electronjs.org/) may be something for you? – KooiInc Oct 30 '22 at 12:47
  • Also HTA is a thread, [read this](https://www.varonis.com/blog/living-off-the-land-lol-with-microsoft-part-ii-mshta-hta-and-ransomware). – KooiInc Oct 30 '22 at 12:58
  • 1
    @Kooilnc The described application doesn't introduce any threat. Electron is a lot more complicated and requires an install. – LesFerch Oct 30 '22 at 13:14
  • Don't be deterred. It's still OK to write HTA apps. For example, [this](https://lesferch.github.io/WinSetView/) and [this](https://lesferch.github.io/DesktopPic/). Exes have the advantage that they can be signed and there's a lower chance of AV false positives, but those are not big issues for non-commercial projects. – LesFerch Oct 30 '22 at 13:22
  • Be sure to set your HTA to run in IE 9 mode (or possibly IE 10 or IE 11 mode with caveats). By default, it will be running in IE 5 mode. See this [answer](https://stackoverflow.com/a/70358044/15764378). – LesFerch Oct 30 '22 at 13:27

0 Answers0