Skip to content

About

Web content in Fuju windows on each system's own engine (WebView2, WKWebView, WPE WebKit, Android WebView, iframe), navigated and scripted from C#, under Native AOT.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Fuju.WebView

Web content in Fuju windows, on each system's own browser engine: a WebPage navigated and scripted from C#, with what it does as state, and a node that shows it, with one script bridge on every system. It works under Native AOT.

System Engine
Windows WebView2 (the Evergreen runtime the system has)
macOS WKWebView
Linux WPE WebKit 2.54 or later, drawn by Fuju under Wayland and X11
iOS WKWebView
Android The Android System WebView, with AndroidX WebKit for the script bridge
Browser HTML <iframe> overlay (full bridge and scripting for same-origin and NavigateToString; cross-origin is display-only under same-origin policy)

Where no engine is found the application still starts; WebViewBackends.DetectEnvironment() says whether one is available and why not.

Using it

Reference the package from a Fuju application:

dotnet add package Fuju.WebView --prerelease
var page = new WebPage();
page.Navigate("https://example.com/");
return WebViewUI.WebView(page).Height(300);

On Linux, most distributions and the Flatpak runtimes have no WPE WebKit with the API Fuju.WebView needs. An application that must show web content there also references Fuju.WebView.WPE, which carries the engine beside the executable; Fuju.WebView loads it from there before looking on the system.

On iOS and Android the page is a system view above the window's content, as on macOS and Windows; Fuju's popups are above it, and a touch on it closes them. A page's alert, confirm and prompt are the system's alerts. On Android the package adds the internet permission to the application; a file input does nothing, the zoom factor is the document's CSS zoom, and a successful navigation reports no status code.

In a browser a page keeps no history: a frame's history is the whole tab's, so CanGoBack and CanGoForward stay false and GoBack and GoForward do nothing. An application that wants back and forward keeps its own list of the addresses NavigationCompleted reports and navigates to them again. When the user follows a link inside a page from another origin, the browser does not say where it went: NavigationCompleted reports the address that was asked for.

The sample

samples/WebView is an application with a browser toolbar built from the page's state and an inline HTML document driven through the script bridge:

dotnet run --project samples/WebView
dotnet run --project samples/WebView -p:FujuWebViewWpe=true   # Linux, with the engine from Fuju.WebView.WPE

The repository builds against Fuju's packages on nuget.org, at the version of Fuju.Sdk in global.json.

Building the package needs the .NET android workload (dotnet workload install android) and the Android SDK for its Android target; -p:FujuWebViewAndroid=false builds without them.

Licence

Apache License 2.0: LICENSE and NOTICE.

About

Web content in Fuju windows on each system's own engine (WebView2, WKWebView, WPE WebKit, Android WebView, iframe), navigated and scripted from C#, under Native AOT.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages