StageWebView
StageWebView is a Windows webview library for Haxe.
It exposes two public APIs:
webview.WebViewfor plain Haxe projectsopenfl.media.StageWebViewfor OpenFL projects that want AIR-style behavior
The native backend is vendored in this repository. hxcpp talks to it directly, HashLink uses a shipped stagewebview.hdll, and the OpenFL layer stays optional unless you actually import it.
Source: https://github.com/dimensionscape/stagewebview
Why it exists
This project is trying to solve two related problems without making either side awkward.
OpenFL projects should have a real StageWebView implementation with a familiar AIR-shaped API. Non-OpenFL projects should be able to use the same backend through webview.WebView without inheriting OpenFL concepts, source paths, or editor noise they never asked for.
The internal backend is kept separate on purpose. That makes the public API cleaner today, and it keeps the lower layer easier to move closer to Lime later if that ever becomes the right call.
What is here now
- Vendored Windows webview backend
- Direct hxcpp bindings
- HashLink hdll support
- Public
webview.WebViewAPI - Optional OpenFL
StageWebViewfacade - Dox-generated API docs
- Samples for basic embedding, live sites, JavaScript bridging, browser UI, and docs browsing
- Release prebuilts for
Windows64
webview.WebView
webview.WebView is the framework-agnostic API. You can embed it inside an existing native host window, or let it create and own a top-level native window of its own.
import webview.WebView; import webview.WebViewHint; var webView = new WebView(null, { debug: true }); webView.onMessage = function (message:String):Void { trace("Page says: " + message); }; webView.setTitle("StageWebView Solo Deck"); webView.setSize(1280, 720, WebViewHint.NONE); webView.loadString("<h1>Hello from plain Haxe</h1>"); webView.run(); This library provides the webview backend. It does not try to be a full general-purpose windowing toolkit, but it is comfortable embedding into one or standing up a small top-level window when that is all you need.
openfl.media.StageWebView
The OpenFL API sits on top of the same backend and aims for AIR parity where that is practical on Windows.
import openfl.geom.Rectangle; import openfl.media.StageWebView; var webView = new StageWebView(); webView.stage = stage; webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight); webView.loadURL("https://www.openfl.org"); Classpath behavior
The published haxelib keeps classPath pointed at src, so pure Haxe projects only see webview.* by default.
When openfl is defined, extraParams.hxml adds src-openfl automatically. That makes openfl.media.StageWebView available for OpenFL users without dumping openfl.* completion noise into projects that do not use OpenFL at all.
Samples
The repository includes a few demo projects:
project.xml: minimal sampleproject-intermediate.xml: live-site demoproject-bridge.xml: JavaScript-to-Haxe bridge demoproject-browser.xml: browser-style sample with tabs and controlsproject-docs.xml: local viewer for the generated API docssamples/pure-haxe/build-cpp.hxml: standalonewebview.WebViewsample with its own native window, local HTML deck, bridge messaging, window resizing, and Haxelib search routing
Generated sample output goes under bin.
Tests
The lightweight test suite runs with:
haxe build/tests.hxml That covers:
webview.WebViewstate and callback behavior through a fake backendopenfl.media.StageWebViewconstructor behavior, viewport validation, and offline state handling
Docs
The docs are generated in two steps:
haxe build/docs-cpp.hxml haxelib run dox -i docs/xml/cpp.xml -o docs/api --title StageWebView -in "^webview$" -in "^webview[.]" -in "^openfl$" -in "^openfl[.]media$" -in "^openfl[.]media[.]StageWebView$" -in "^openfl[.]events$" -in "^openfl[.]events[.](LocationChangeEvent|WebViewDrawEvent)$" The generated site ends up in docs/api.
Scope
- Windows only
- Windows x64 only for the first release
- hxcpp and HashLink
- AIR-style
StageWebViewparity where the platform allows it - Public APIs kept library-owned, with the backend kept internal