Back to Wails

WebView API Compatibility Check

v3/examples/webview-api-check/README.md

2.13.02.8 KB
Original Source

WebView API Compatibility Check

This example application tests and reports which Web APIs are available in the current WebView engine.

Purpose

Different platforms use different WebView engines:

  • Linux GTK4: WebKitGTK 6.0 (WebKit-based)
  • Linux GTK3: WebKit2GTK 4.1 (WebKit-based)
  • Windows: WebView2 (Chromium-based)
  • macOS: WKWebView (WebKit-based)

Each engine supports different Web APIs. This tool helps you understand what APIs are available for your Wails application on each platform.

Building

bash
# Linux GTK4 (default)
go build -o webview-api-check .

# Linux GTK3 (legacy, opt-in)
go build -tags gtk3 -o webview-api-check .

# Windows/macOS
go build -o webview-api-check .

Usage

  1. Run the application
  2. Click "Run API Tests" to test all Web APIs
  3. View results organized by category
  4. Use filters to find specific APIs
  5. Export report as JSON for comparison

API Categories Tested

CategoryAPIs Tested
StoragelocalStorage, IndexedDB, Cache API, File System Access
NetworkFetch, WebSocket, EventSource, WebTransport
MediaWeb Audio, MediaRecorder, MediaDevices, Speech
GraphicsCanvas, WebGL, WebGL2, WebGPU
DeviceGeolocation, Sensors, Battery, Bluetooth, USB
WorkersWeb Workers, Service Workers, Shared Workers
PerformanceObservers, Timing APIs
SecurityWeb Crypto, Credentials, WebAuthn
UI & DOMCustom Elements, Shadow DOM, Pointer Events
CSSCSSOM, Container Queries, Modern Selectors
JavaScriptES Modules, BigInt, Private Fields, etc.

Understanding Results

  • Supported (green): API is fully available
  • Partial (yellow): API exists but may have limitations
  • Unsupported (red): API is not available

Some APIs are marked with notes:

  • "Chromium only" - Available in WebView2 but not WebKit
  • "Experimental" - May not be stable
  • "Requires secure context" - Needs HTTPS
  • "PWA context" - Only available in installed PWAs

Comparing Platforms

Run the app on different platforms and export JSON reports. Compare them to understand API availability differences:

bash
# On Linux GTK4
./webview-api-check
# Export: webview-api-report-linux-20240115-143052.json

# On Windows
./webview-api-check.exe
# Export: webview-api-report-windows-20240115-143052.json

Known Differences

WebKitGTK vs WebView2 (Chromium)

WebView2 (Windows) typically supports more APIs because Chromium is updated more frequently:

  • File System Access API (Chromium only)
  • Web Serial, WebHID, WebUSB (Chromium only)
  • Various experimental features

WebKitGTK may have better support for:

  • Standard DOM APIs
  • CSS features (varies by version)

GTK3 vs GTK4 WebKitGTK

GTK4 uses WebKitGTK 6.0, GTK3 uses WebKit2GTK 4.1. The WebKit version determines API support, not GTK version.