DEV Community

Gokul Kathirvel
Gokul Kathirvel

Posted on

Will desktop #PWAs kill hybrid wrappers like electronjs?

We can notice the rise of Progressive Web Apps in recent times. Today I notice desktop PWA support in chrome under a flag (chrome://flags/#enable-desktop-pwas). It installs the apps like a chrome app in OSX which is something similar what wrappers like electronjs does! I personally like electronjs very much becoz if it’s simplicity. Will the new desktop PWAs kill wrappers?

Top comments (12)

Collapse
 
kspeakman profile image
Kasey Speakman

No. Electron allows you to interface with the local computer system. Whereas PWAs still have a sandboxed model and more limited access. In fact one of the primary reasons to use a desktop app in the first place is to get that access you can't get from web apps. E.g. directly writing to printers, interfacing with running accounting software, etc. PWAs add access to a few more services, but is not a replacement for a desktop app.

Collapse
 
ben profile image
Ben Halpern

I agree with this but how long until the sandbox widens so much that the differences aren't that important?

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

That I could not say. There is no technical reason why PWAs could not do everything desktop apps could do in the future.

One big concern is security. Compared to a compiled app, javascript is a much more exposed attack vector. Because a web app can inject arbitrary javascript in an ad-hoc manner. It is common for desktop apps to download data, but less so to download and execute new code. (This is normally a user-permitted process: installing updates or plugins. Otherwise it's probably malware.) Javascript only gets away with it because of sandboxed access. It would be possible to place restrictions on dynamic loading so that the PWA could have more unfettered access. E.g. Disable eval, disable adding script tags to the DOM, etc. Maybe even require all content has to be included and "compiled" into a single page.

The harder problem could be that browsers would need to develop cross-platform unified APIs to access hardware. That is a very large elephant to eat, and the browser would essentially become a virtual machine on top of the OS. Seems Chrome already had this inkling, but this level of standardization is still a ways off if something "better" doesn't supplant it in the meantime. (It is tech after all.)

Thread Thread
 
hrmny profile image
Leah

There's a thing called csp which can disallow eval and script tags without a nounce

Thread Thread
 
kspeakman profile image
Kasey Speakman

Interesting. I'd still like it better if browsers strictly disabled such things in PWAs instead of me having the capability to screw up the CSP headers.

Collapse
 
andy profile image
Andy Zhao (he/him)

Agreed, I think PWAs have a long time until they catch up to desktop app functionality.

Collapse
 
gokatz profile image
Gokul Kathirvel

Thanks for the thoughts @kasey. Agreed! If my app is limited to less hardware/machine level access, then is it clever to invest in PWAs??

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

Yes, I think it is wise to invest in PWAs. You basically get to reuse the same web skills, and add in a (comparatively) few PWA particulars. Although the caching bit can bite you. It is a big win for many kinds of apps to be installable and usable offline on mobile and desktop without having to pick up a completely different toolchain.

Collapse
 
nektro profile image
Meghan (she/her)

On your first point, that flag isn't required to add apps to your desktop. If you click the three-dots menu in the top right, under "More tools", there should be an option that says "Add to desktop..."

Second, I don't think web apps will entirely replace "native" applications, but I don't see any reason why these apps couldn't be made with tech very similar to JS, HTML, etc. On the other hand, I definitely do not think that web apps should ever get free roam access to a user's filesystem. I don't think native apps should even have free access to the filesystem but you can't fix the past, only build a better future.

For instance, it wouldn't make sense for a web site to have an API to host a web server. But a server and no-CORS networking is definitely an API some apps would want and make total sense in some cases. Something similar to ChromeOS is definitely the future, but it was ahead of its time because Google is really bad at advertising its own technology. The future I see is 99% of apps are web sites, and the small rest of apps use some standard for accessing native APIs (think POSIX 2042).

Collapse
 
lloydvincent profile image
LloydVincent

PWAs are gaining popularity because they have definite advantages like small distribution size, zero install hassle, security (from the user's perspective) and ease of update. Their capabilities are surprisingly broad too; I recently built a script editor for a commercial game as a PWA and since the final app resides on the local filesystem loading/saving JSON files was easy. Playing sound files and auto-loading images out of the asset folder was easy. Basically everything was easy and the using framework components (Ionic) for the UI made that part incredibly easy too.

There will always be some things a PWA just can't do (and should not do), but those cases are steadily becoming more niche.

Collapse
 
aswathm78 profile image
Aswath KNM

I certainly think it won't.

PWA's are useful for using websites offline.

Text editors like Atom and VS code can't be done as a PWA .

So I'm pretty much sure PWA is not a Hybrid killer.

It'll be very helpful in one case though.

Instead of using tag and stand alone apps for websites, PWA avoid such websites to develop such apps

Collapse
 
j209 profile image
j209