Overview
Non-normative guidance for host implementers on iOS, macOS, Android, and Windows.
These pages show one way to satisfy the Contract on each platform. They are non-normative: where they differ from the Contract, the Contract wins. Treat the code as a starting point, not a copy-paste drop-in.
A conforming host, on any platform, must:
- Expose the
todayWebViewBridgechannel as an object with apostMessage(message): Promisesurface. - Dispatch on the message
typeand implementtrack,headers, andrefreshTokenper Capabilities. - Resolve
undefinedfor any unknowntype— never reject. - Reject with a non-empty error string only where the Contract allows it
(
refreshToken). - Coalesce concurrent
refreshTokencalls into a single real refresh.
The platform difference is entirely in how the promise-returning channel is
constructed. Apple WebViews get it for free; Android and Windows wrap their
transport in a thin shim that restores the postMessage(message): Promise
surface.
- iOS —
WKScriptMessageHandlerWithReply. - macOS — the same
WKWebViewhandler, hosted in AppKit. - Android —
WebViewCompat.addWebMessageListeneror a@JavascriptInterface+ callback shim. - Windows — WebView2 host object or
chrome.webview.postMessage+ request-id shim.
Two platform pairs share a transport and so cannot be told apart from the channel
shape alone — iOS vs macOS (both WKWebView) and Android vs Windows (both
expose a global channel object). Each host MUST inject the
platform tag to disambiguate its half of the pair.