0

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.

Joshua Smith
  • 3,689
  • 4
  • 32
  • 45

1 Answers1

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.

  • My full desktop version has some complexity, but for this one deployment I can just leave those features out and basically do it like a static website. I was hoping to avoid having to learn the whole MS toolchain if I could (although I now have Win10 in a VM on my Mac since I had to do that to build the appx that the Hub won't run). Can you point me to a webapp hello world example so I can see what "fairly straight forward" means on MS these days? (I haven't written MS-specific code in 15 years.) – Joshua Smith Aug 24 '17 at 12:14
  • I found this hello world example. https://learn.microsoft.com/en-us/windows/uwp/get-started/create-a-hello-world-app-js-uwp Is that what you were suggesting? – Joshua Smith Aug 24 '17 at 19:17
  • It also appears that to use this approach to build our app is going to require an $800 copy of Visual Studio, since the free "Community" version can't be used by enterprises with non-negligible revenue. – Joshua Smith Aug 24 '17 at 19:52
  • https://github.com/MicrosoftEdge/appx-starter - this is a good option for building and testing the appx on Windows. What is your preferred toolchain? At the end of the day there are commandline ways to create the .appx pacakage. We'd made this yo generator to help with alternatives to having to use Visual Studio. – Kevin Hill - Salesforce Aug 24 '17 at 20:59
  • We use a variety of shell scripts on OS X to do our builds. I'll use the free VS version to do a prototype, then see if I can figure out how to generate the .appx myself based on what VS puts in the one it creates. I've already been through manifest generation once, getting the Electron app converted. I'll keep you posted. – Joshua Smith Aug 25 '17 at 14:43
  • Let me know if you see any problems! – Kevin Hill - Salesforce Aug 25 '17 at 15:48
  • There are a couple issues, but for the most part, I can generate a manifest and use MakeAppx.exe to bundle it all up. It mostly just works. I'm doing a dry run store submission now to see what goes wrong. Any idea how my app can show the user a PDF? If it try to just open it, the Edge WebView crashes. If I try to show it using PDFJS, that also crashes. On the desktop, I usually hand off to the O/S for PDFs, but I don't know how to do that from a webapp like this (the PDF is baked in so it's a ms-appx:// URL). – Joshua Smith Aug 26 '17 at 18:45
  • I made a question for the PDF stuff: https://stackoverflow.com/questions/45900180/how-to-launch-a-pdf-from-a-uwp-universal-windows-platform-web-application – Joshua Smith Aug 26 '17 at 22:32
  • I posted an answer for the PDF question. We are moving templates away from WinJS, so if you focus on just the raw JavaScript calls to render a PDF you'll be in good shape. – Kevin Hill - Salesforce Aug 27 '17 at 06:21