Joshua Smith
Joshua Smith

Reputation: 3809

How to port an Electron App to UWP for Surface Hub

I have an application that is currently using Electron for Windows desktop deployment. The bulk of the user interface is plain old JS/CSS/HTML5 and the node part is mostly just infrastructure to get the data into the chromium part. It's pretty much what people used to call a "WebApp" before Firefox and Chrome walked away from that idea.

I was able to convert this existing Electron app to UWP using makeappx and I even got it into the Window Store, only to discover that the Surface Hub refuses to run it because it's not "pure" UWP, but rather a Win32 app wrapped up to look like UWP. Running on the Surface Hub is a requirement for my customer.

The application works fine in Edge, but my customer needs to be able to use the app when there is no internet connection.

My next idea was to put the application onto a flash drive, and just point Edge at that. Of course, browsing file:// URLs doesn't work on this hardware, so that didn't work.

My next thought was that I could build a simple HTTP server, get that into the store with the content baked in (or reading the content from a flash drive), and then have them point Edge at localhost. However, I've found a bunch of docs that say using the loopback device is banned in Windows Store apps. (There's a workaround for enterprise apps, but I don't know if that would work on the Surface Hub, and the client really just wants to install from the Windows Store and not have to do anything weird).

There was some chatter a year ago about Microsoft making some technology to make it easy to port web apps to the Windows desktop. I found "Windows 10 Hosted Web Apps" but that appears to just make a web store container around a website. In my case, the website wouldn't be available, since they need to run the thing offline. There doesn't seem to be a "Not Hosted" Web App option, as far as I can tell.

Back when Chrome did hosted web apps, I managed to use an offline manifest to convince the browser to download the whole app the first time you run it. But that never worked reliably because Chrome would spontaneously throw out the Caches for no good reason. Since the Surface Hub aggressively throws away caches when you end a session, I suspect that approach won't work either. (I found a Windows blog entry from last year that seems to be describing this trick and calling it Progressive Web Apps or PWA; however, since it's based on cache workers, my concern about the Surface Hub just throwing it away stands.)

So, how can I make my web app work offline on a Surface Hub? I'm perfectly happy to have a flash drive as part of the solution if that helps.

-- update --

See accepted answer. Turns out you don't need developer studio to do this. If you create a AppxManifest.xml file and put your whole webapp into a folder, you can use MakeAppx.exe to bundle it all up. Note that the Windows Store has some strange requirements, like your UTF-8 files need a BOM on the front.

Upvotes: 0

Views: 1008

Answers (1)

For your Electron application are you using any native modules? Generally if you aren't relying on native modules creating a Windows Web Application is fairly straight forward. For Windows Web Applications you can mix local content with remote content fairly easily.

Upvotes: 1

Related Questions