Here is my code that uses JCEF to show an embedded web browser in CfD
Usage:
https://github.com/davidwhitman/SMOL/blob/dev/App/main/kotlin/smol_app/browser/ModBrowser.kt#L372>
Browser:
https://github.com/davidwhitman/SMOL/blob/dev/App/main/kotlin/smol_app/browser/chromium/CefBrowserPanel.kt
Gradle:
https://github.com/davidwhitman/SMOL/blob/dev/App/build.gradle.kts#L125
JCEF:
https://github.com/davidwhitman/SMOL/tree/dev/App/libs/jcef-v1.0.18
• It's 200mb. Yeah.
• The browser randomly goes white and the only fix I've found it restarting the application.
• The browser is on top of the rest of the application, due to this Compose bug:
https://github.com/JetBrains/compose-jb/issues/1087
• This setup is Windows-only, Unix is left as an exercise for the reader.
So, this is far from an ideal solution, but it is one. Incidentally, if someone has a better solution for a webview, I'd love to hear it. I tried JavaFX and found it buggy and even harder to use, although it was only ~75MB.
It would be fantastic if there was a way to use webviews provided by the OS, eg
https://docs.microsoft.com/en-us/microsoft-edge/webview2/, as currently my application comes in at 400MB, with less than 15 MB of that being my code and gradle dependencies; the rest is Compose runtime and JCEF.