Using built-in system webviews

124 views
Skip to first unread message

Ashley Gullen

unread,
Feb 11, 2021, 11:31:16 AM2/11/21
to nw.js
Hi all,

Thanks for your continuing work on NW.js! I had a suggestion that could be potentially interesting but I'm not sure of the technical feasibility of it.

Pretty much the only complaint we ever hear about NW.js is the file size overhead is quite large - maybe 80mb or so depending on how it's compressed and which features are included. Of course, this is due to the fact it contains the entire Chromium browser engine. Subsequent updates must also ship this again if it is to update to the latest browser engine. I didn't think the file size overhead mattered much since most people have lots of storage and fast connections these days, but it still seems to get mentioned.

These days Windows ships with WebView2 built-in, which like Edge, is now also based on the Chromium browser engine: https://docs.microsoft.com/en-us/microsoft-edge/webview2/
macOS also includes a WKWebView control that similarly appears to be built-in to macOS: https://developer.apple.com/documentation/webkit/wkwebview - although this would use WebKit, a different browser engine (but still historically related - NW.js was "node-webkit" once after all!)
I'm not sure what the situation is for Linux.

I'm not sure what the feasibility is of integrating node.js into these webviews. However these days, at least for us, it may not be too big a problem if node is not included. The web platform has continued to advance and now covers things like File System Access in Chrome which we can use instead of node for file system operations. The number of things we have to use the node aspect for is shrinking, and could probably be polyfilled in other ways.

So there may be an opportunity for a modernised desktop-web hybrid framework that uses the system webviews, which could have various benefits:
  • Smaller file size to distribute
  • System webviews automatically kept up-to-date (no need to distribute updated browser engines)
  • Polyfill missing browser APIs (e.g. File System Access)
  • Polyfill desktop-specific extras (e.g. controlling the window, accessing command line...)
  • Possibly simpler technology stack (especially if no node)
It would essentially be a system webview + bundled resources + polyfills. It could offer some interesting advantages to other tools like Electron too. I'm not sure how feasible this would be though, or how many existing NW.js users would consider switching. Perhaps it could be an extra distribution alternative, or maybe just a separately distributed product. I'd definitely be interested in using this with Construct 3 (www.construct.net), our web-based game development software that uses NW.js to export web games to desktop platforms.

Any thoughts on this?

Ashley

Roger Wang

unread,
Feb 11, 2021, 9:39:17 PM2/11/21
to Ashley Gullen, nw.js
I have a plan to build a lite version of NW.js, which includes only part of Chromium engine providing features used by the application. It excludes everything else which is not used. In this way, the binary size could be dramatically reduced.

The lite version could be in multiple flavors. Each of them would cover different usage scenarios from applications.

Roger

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nwjs-general/CAABs73gmJQroDWB9zEQ9K8xfvr3zpzOL6DZThYf2N9C_1GSKjw%40mail.gmail.com.

Арсен Боровинский

unread,
Feb 12, 2021, 4:45:13 AM2/12/21
to nw.js
React Native can be used with system webview: https://github.com/react-native-webview/react-native-webview.

React Native support iOS/Android/Windows/macOS, but on Windows use old Edge core.

четверг, 11 февраля 2021 г. в 21:31:16 UTC+5, a...@scirra.com:

Aurelien B

unread,
Feb 16, 2021, 8:40:58 AM2/16/21
to nw.js
Ashley, 

Similar projects integrating the native OS webview component already exist but are still in early development:

tauri-apps/tauri, which has a Rust backend to serve the application.

webview/webview-deno, which uses deno as a backend (the new iteration of nodejs from nodejs creator)

Both projects use webview/webview but the rust bindings to it are not quite yet ready for cross-platform developments, and on windows, there are still some bugs upstream in webview/webview causing the whole OS to become unstable...

In fact, the current version of webview/webview-deno still uses EdgeHTML and not the Webview2 component.

Aurelien

Aurelien B

unread,
Feb 16, 2021, 9:18:07 AM2/16/21
to nw.js
NW.js is still the most complete solution today for building desktop applications with modern web technologies. A lite NW.js version sounds good too.

Aurelien B

unread,
Feb 20, 2021, 1:26:47 PM2/20/21
to nw.js
Roger,

If somehow it was possible to isolate the Picture-In-Picture v2 component from the chromium project, which will soon allow to display custom frameless arbitrary HTML panels onto the desktop, that could be great and perhaps allow to reduce the size of the executable.

Aurelien B
Reply all
Reply to author
Forward
0 new messages