pojala / electrino

Desktop runtime for apps built on web technologies, using the system's own web browser engine
MIT License
4.38k stars 101 forks source link

Windows support radical Idea? #9

Closed wis closed 7 years ago

wis commented 7 years ago

this sounds crazy, but hear me out, don't reject the idea right away, research & think about it.

Microsoft has this ancient technology called HTML Applications (HTA) on Windows since Windows XP. it was a failure, and was discontinued. it's even patented, LOL oh classic 2003 Microsoft.

but mshta.exe is still on every windows installation since Windows XP. and I don't think it's going to be removed in any future Windows release. I am currently playing with HTA(s) on my Windows 10 (1703) machine.

HTA(s) can have access to the machine (the "this program can make changes to your PC" YES | NO dialogue) HTA(s) can run scripts that can do native things, like modifying the registry, file system IO operations, etc..

it uses the default Internet Explorer of the Windows installation. to render and run the scripts of the "*.hta" file in the HTA Host (C:\Windows\SysWOW64\mshta.exe).

HTA(s) run Javascript (JScript) scripts and VB scripts in Internet Explorer compatibility mode. in IE compatibility mode (IE 8) I believe you are restricted to EcmaScript 3. but transpilation can help with that. bebel and the Typescript transpile to ES3, Typescript even transpiles the async/await ES6 feature to ES3.

according to my research HTA(s) scripts can call .NET dlls and powershell and any program from shell. I think we can make a bridge to Node.js with that capability. think of Edge or the cross platfrom .NET Core Javascript Services Library

I know its IE, every web developer's nightmares, but we can polyfill everything in it.

this will solve Electron's issue of installing Chromium with every Electron App on Windows.

norman784 commented 7 years ago

Sounds good, but Microsoft already has a replacement for it and its called UWP.

UWP apps use the Windows Runtime, a native API built into the operating system. This API is implemented in C++ and supported in C#, Visual Basic, C++, and JavaScript. Some options for writing apps in UWP include:

  • XAML UI and a C#, VB, or C++ backend
  • DirectX UI and a C++ backend
  • JavaScript and HTML

This option will be better IMO because you can distribute your app from the windows store and also will support other platforms.

PC, tablet, phone, Xbox, HoloLens, Surface Hub and more

So building around a legacy library will make harder to maintain in mid/long term.

styfle commented 7 years ago

Windows Support discussion is happening on #6

pojala commented 7 years ago

Yes, I think using new APIs described by @norman784 would be the more future-proof choice. (Also because working with legacy Win32 APIs sounds scary... I used to write DirectShow-based code a decade ago and still have nightmares ;))

Further discussion can go into #6 I think?

zspitz commented 6 years ago

It's possible to use a hack to get IE 11 support -- if within the .hta file you navigate to an .html file, the latest IE (not Edge) will be used. https://stackoverflow.com/a/50495897