Documentation
¶
Overview ¶
Package webview embeds a web engine in a bellui layout.
It spans two hosting models, chosen per platform by NewHost. On macOS, iOS, Android, Windows and the web target the engine is an OS view drawn *over* bellui's surface through widget.NativeViewHost, with every one of that host's documented limitations — nothing bellui draws can appear above the content, and core.Canvas.Capture does not see it; read the widget.NativeViewHost documentation before designing around those targets. On Linux the engine (CEF) renders offscreen and the content is composited *inside* bellui's canvas: overlays, dialogs and menus draw above it, Capture sees it, clipping and opacity apply, and the host is a Tab stop, because bellui owns the keyboard rather than the OS.
The package is an optional import: the web engine binding is only linked into binaries that import it, so an app that embeds no web content pays nothing.
Support is per-platform — see Supported. On an unsupported platform New still returns a usable value whose WebView.Attach fails, leaving the host inert (it occupies its space and draws nothing) rather than panicking, so a cross-platform app compiles and runs everywhere.
Platforms ¶
macOS WKWebView, hosted in the GLFW content view iOS WKWebView, hosted in the app window beside the GLKView Android android.webkit.WebView, hosted on the decor view Windows WebView2, hosted in a child window of the app window Web an <iframe> positioned over the canvas Linux CEF, bundled by the app, rendered offscreen and composited
Every backend except Linux uses the platform's **own** engine, so no web engine is bundled into those binaries and security updates stay with the OS vendor; Windows's engine is a separate OS component rather than part of the OS image — see ErrRuntimeMissing.
Linux is the deliberate exception to that policy, because it is the one target with no engine an app can lean on: WebKitGTK is LGPL (outside this project's allowed dependency set) and needs a GTK main loop, WPE — measured in #60 — is unbundled, ABI-coupled to the distro and absent from Ubuntu since 22.04, and no distribution packages CEF. So on Linux **the application bundles the engine**: `bellui package` lays the pinned CEF payload out beside the binary, this package finds it at run time (BELLUI_CEF_DIR overrides the search), and a binary running without it reports ErrRuntimeMissing and degrades to an inert host. The app owner accepts the payload size and the Chromium update cadence — that trade was made knowingly (#60, #105), and what it buys is the composited model described above.
The browsing profile — cookies, localStorage, the HTTP cache — persists by default at "webview-cef" under the app's bellui.Storage root, matching what every other backend's engine does in its own platform-managed location, so a login survives a restart everywhere. SetCEFProfileDir moves it; SetCEFProfileInMemory opts out and discards it on exit. Both must run before the first WebView.Attach, which is when the engine initializes, once per process.
Supplying a Linux backend yourself ¶
The built-in backend is not the only option. widget.NativeView is a public interface with no unexported methods, so an application — or a third-party module — that wants a different engine can implement one and host it with widget.NewNativeViewHost, with no change to bellui:
view := myengine.New(...) // implements widget.NativeView host := widget.NewNativeViewHost(view)
Whoever supplies it pins their own engine version, owns their own update cadence, and ships it in their own Flatpak/AppImage/tarball. Such a backend must satisfy the whole widget.NativeView contract — including a native clip in SetGeometry, or the view will overflow an enclosing [container.Scroll] — and should implement widget.NativeViewFocuser as well, or bellui's focus and the OS keyboard focus will drift apart. This package is not involved: a supplied backend is used through the host directly, and being window-hosted it carries the hole punch's limitations, not the composited model's.
Each platform bends the API where its engine does. Every such difference is documented on the backend that has it, and the ones worth knowing before choosing a design are:
- On the web target the bridge, WebView.Eval and WebView.Call reach same-origin content only, WebView.OnNavigate sees only the navigations this package starts, and WebView.CanGoBack always reports false. All three are browser policy for framed content.
- On the web target and Android the page-side bridge is injected when the document loads rather than before it runs, so a page's own first lines may not see window.bellui. WebView.LoadHTML on the web target is the exception: the shim travels in the content itself.
- On Android and Windows a script that throws reports a null result rather than an error, because neither evaluateJavascript nor ExecuteScript has a channel for an exception. A WebView.Call made against a page with no shim therefore stays pending on those two until the view is destroyed, instead of failing at once.
- On Windows and Linux WebView.LoadHTML ignores its baseURL — WebView2's NavigateToString takes no base, and CEF has no literal-content API at all so the content travels as a data: URL — so the content's relative references do not resolve and its origin is always OriginOpaque.
- On Windows a navigation the user started is reported as NavigationLinkClicked whatever they did to start it, including submitting a form: WebView2 reports that the user initiated it, not how.
- On Linux the host is a Tab stop, and while the page is focused plain Tab / Shift+Tab traverse the page's own tab order; Ctrl+Tab / Ctrl+Shift+Tab leave it and continue in bellui's focus ring (#126). IME composition is forwarded like any other text input (#121): the OS preedit renders inline in the page and the candidate window follows the page's caret.
Talking to the page ¶
Two channels connect bellui logic and page logic, and neither hosting model constrains them: the models differ in what can be drawn over the view and who owns the keyboard, not in what can be exchanged with it.
- WebView.Eval and friends run JavaScript in the page, optionally reporting its result.
- The bridge — WebView.EnableBridge, WebView.Handle, WebView.Call, WebView.Post and WebView.OnMessage — is a two-way, JSON-typed, request/response channel with a page-side `window.bellui` object.
The bridge is **off until it is enabled**, and enabling it takes an OriginPolicy naming the content that may use it. See WebView.EnableBridge for why untrusted remote content must not be handed a message channel.
Navigation ¶
WebView.LoadURL, WebView.LoadHTML, WebView.GoBack, WebView.GoForward, WebView.Reload and WebView.StopLoading drive the engine; WebView.OnLoadChanged reports progress and failure, and WebView.OnNavigate can veto a navigation before it starts.
Threading ¶
Every method must be called on the main goroutine, and every callback this package makes — messages, results, load events, navigation decisions — runs on it too.
Since: 1.0
Index ¶
- Constants
- Variables
- func NewHost(url string) (*Host, *WebView)
- func SetCEFProfileDir(dir string) error
- func SetCEFProfileInMemory() error
- type Args
- type Handler
- type Host
- type LoadEvent
- type LoadState
- type Message
- type NavigationKind
- type NavigationRequest
- type OriginPolicy
- type WebView
- func (w *WebView) Attach(win bellui.Window) error
- func (w *WebView) BridgeEnabled() bool
- func (w *WebView) Call(name string, arg any, onResult func(json.RawMessage, error))
- func (w *WebView) CanGoBack() bool
- func (w *WebView) CanGoForward() bool
- func (w *WebView) Destroy()
- func (w *WebView) EnableBridge(policy OriginPolicy)
- func (w *WebView) Eval(js string)
- func (w *WebView) EvalFunc(body string, args Args)
- func (w *WebView) EvalFuncResult(body string, args Args, onResult func(json.RawMessage, error))
- func (w *WebView) EvalResult(js string, onResult func(json.RawMessage, error))
- func (w *WebView) GoBack() bool
- func (w *WebView) GoForward() bool
- func (w *WebView) Handle(name string, fn Handler)
- func (w *WebView) HasFocus() bool
- func (w *WebView) LoadHTML(html, baseURL string)
- func (w *WebView) LoadState() LoadState
- func (w *WebView) LoadURL(url string)
- func (w *WebView) Post(payload any)
- func (w *WebView) Reload()
- func (w *WebView) ResignFocus() bool
- func (w *WebView) SetGeometry(rect, clip geo.Rectangle, scale float32)
- func (w *WebView) SetVisible(visible bool)
- func (w *WebView) StopLoading()
- func (w *WebView) TakeFocus() bool
- func (w *WebView) URL() string
Constants ¶
const OriginOpaque = "null"
OriginOpaque is the origin reported for page content that has no origin of its own — a data: URL, about:blank, or a sandboxed frame. It matches the HTML specification's serialization of an opaque origin.
Content served from a file: URL reports "file://" instead, and ordinary web content reports scheme, host and non-default port, e.g. "https://example.com" or "http://localhost:8080".
Since: 1.0
const Supported = true
Supported reports whether this platform has a web engine binding.
Since: 1.0
Variables ¶
var ( // ErrNotAttached is reported when the view has no native web engine — // either it has not been attached to a window yet, or it has been // destroyed, or the platform has no web engine binding at all // ([Supported] is false). ErrNotAttached = errors.New("webview: not attached to a window") // ErrBridgeDisabled is reported when a bridge operation is attempted on a // view whose bridge was never enabled with [WebView.EnableBridge]. ErrBridgeDisabled = errors.New("webview: bridge is not enabled") )
Errors reported to a bridge or eval callback instead of leaving it pending. A callback this package accepts is always called exactly once, so a caller never has to distinguish "failed" from "never answered".
Since: 1.0
ErrNavigationCancelled is the LoadEvent.Err of a navigation that WebView.OnNavigate refused, and of one stopped with WebView.StopLoading.
Since: 1.0
var ErrRuntimeMissing = errors.New("webview: the web engine runtime is not installed")
ErrRuntimeMissing is reported by WebView.Attach when the platform's web engine exists as a separate component and that component is not there. Two platforms report it, for different reasons:
- On Windows it means no WebView2 Evergreen Runtime is installed, or the installed one is older than this package requires. The runtime ships with Windows 11 and with Microsoft Edge, but a Windows Server or LTSC image may not have one — an app that must work everywhere should ship the Evergreen Bootstrapper alongside it (https://developer.microsoft.com/microsoft-edge/webview2/).
- On Linux it means no bundled CEF payload was found. CEF is not a system component on any distribution — it travels with the application (`bellui package` lays it out; BELLUI_CEF_DIR overrides the search), so this is the error an unpackaged binary reports on a machine that never received the payload.
Either way Attach failing leaves the host inert — it occupies its space and draws nothing — exactly as on a platform with no binding at all, so handling the error is a chance to offer the content another way, not a requirement for the app to keep running.
It is declared on every platform so that a cross-platform app can test for it with errors.Is without a build tag; no other platform reports it.
Since: 1.0
Functions ¶
func NewHost ¶
NewHost returns a Host embedding a new web view for url, and the view for driving it. It is the one-call form of wrapping New in a host.
Since: 1.0
func SetCEFProfileDir ¶
SetCEFProfileDir tells the Linux (CEF) backend to persist its browsing profile — cookies, localStorage, the HTTP cache — at dir. The directory is created by the engine as needed and should be an absolute path; a relative one is resolved against the working directory when the engine starts. An empty dir restores the default.
The profile persists by default, at "webview-cef" under the running app's bellui.Storage root, so this call is for apps that want it somewhere specific. Call SetCEFProfileInMemory to discard it on exit instead.
CEF is initialized once per process, on the first WebView.Attach, and the profile location is fixed from then on: call this before that first Attach, on the main goroutine. Afterwards it changes nothing and reports an error.
CEF guards a profile directory with a process-singleton lock. When a second app instance reaches its first Attach while another holds the same directory, the engine fails to initialize and every web view in that instance stays inert, reporting the failure from Attach. An app expecting concurrent instances should give each its own directory, keep the profile in memory, or use single-instance mode.
Only the Linux backend has a profile of its own to place — everywhere else the platform engine manages it — so on other platforms this reports nil and changes nothing.
Since: 1.0
func SetCEFProfileInMemory ¶
func SetCEFProfileInMemory() error
SetCEFProfileInMemory tells the Linux (CEF) backend to keep its browsing profile in memory, discarded when the process exits — the explicit opt-out from the persistence described on SetCEFProfileDir. Web views then behave like an incognito window: no cookie, localStorage value or cached response survives a restart.
The engine still writes a little installation-specific data (its process-singleton lock among it); that goes to a fresh directory under os.TempDir, so concurrent instances never contend and nothing durable is left behind.
The same restrictions as SetCEFProfileDir apply: call it before the first WebView.Attach, on the main goroutine; it has no effect off Linux.
Since: 1.0
Types ¶
type Args ¶
Args are the named arguments of WebView.EvalFunc, marshalled to JSON and passed to the script as data. Each name must be a JavaScript identifier; it becomes a parameter of the function the body runs as.
Since: 1.0
type Handler ¶
Handler answers a request the page made with window.bellui.call. Its result is marshalled to JSON and resolves the page's promise; a non-nil error rejects that promise with the error's message, so failure is reported to the page rather than swallowed.
It runs on the main goroutine, with the engine's own callback waiting behind it, so it must return promptly. Hand slow work to a goroutine and report it later with WebView.Post.
Since: 1.0
type Host ¶
type Host struct {
widget.BaseWidget
// contains filtered or unexported fields
}
Host places a WebView in a bellui layout. Create one with NewHost.
It exists because the package spans two hosting models and an app should not have to know which one it got. On macOS, iOS, Android, Windows and the web target the engine is an OS view positioned over the canvas, hosted by a widget.NativeViewHost with all of that host's documented limitations. On Linux the engine (CEF) renders offscreen and the content is composited *inside* bellui's canvas — overlays draw above it, core.Canvas.Capture sees it, clipping and opacity apply, and the host is a Tab stop, because bellui owns the keyboard rather than the OS. While the page is focused, Tab traverses the page's own tab order; Ctrl+Tab / Ctrl+Shift+Tab return to bellui's focus ring (#126).
All methods must be called on the main goroutine.
Since: 1.0
func (*Host) CreateRenderer ¶
func (h *Host) CreateRenderer() core.WidgetRenderer
CreateRenderer returns a renderer showing the platform hosting widget — the widget itself, by identity, per the hostImpl.object contract.
func (*Host) FocusNativeView ¶
FocusNativeView hands the keyboard to the web content — the OS focus on a hole-punch platform, canvas focus on the composited Linux host — and reports whether it was accepted.
func (*Host) NativeViewFocused ¶
NativeViewFocused reports whether keystrokes currently go to the web content rather than to another bellui widget.
func (*Host) SetMinSize ¶
SetMinSize sets the smallest size this host should be laid out at, in device-independent points. Web content has no intrinsic size bellui can measure, so the default is 0x0 and the host takes whatever the layout gives it.
func (*Host) SyncStats ¶
SyncStats reports the per-frame geometry sync counters of a hole-punch host — see widget.NativeViewHost.SyncStats. The composited Linux host runs no geometry sync (the content is a widget, layout reaches it like any other), so both counters stay zero there.
type LoadEvent ¶
type LoadEvent struct {
// State is the state the view has just entered.
State LoadState
// URL is the address being loaded, as the engine resolved it. It may
// differ from the URL that was requested, after a redirect.
URL string
// Err says why a load failed, and is nil for every other state. A
// navigation the app itself cancelled from [WebView.OnNavigate] is
// reported as a failure with [ErrNavigationCancelled], so a cancel is
// never mistaken for a network problem.
Err error
}
LoadEvent reports a change of WebView.LoadState, delivered to WebView.OnLoadChanged on the main goroutine.
Since: 1.0
type LoadState ¶
type LoadState int
LoadState is what the view's main frame is doing. It changes only for main frame navigations; a sub-frame loading its own content does not move it.
Since: 1.0
const ( // LoadStateIdle is a view that has not been asked to load anything yet. LoadStateIdle LoadState = iota // LoadStateLoading is a navigation in progress. LoadStateLoading // LoadStateComplete is a navigation that finished. LoadStateComplete // LoadStateFailed is a navigation that did not finish. The reason is in // [LoadEvent.Err]. LoadStateFailed )
type Message ¶
type Message struct {
// Name is the handler the page addressed, for a request made with
// window.bellui.call. It is empty for a posted notification.
Name string
// Payload is the value the page sent, still encoded. Read it with
// [Message.Decode]. It is the JSON null literal when the page sent
// nothing, never nil.
Payload json.RawMessage
// Origin is the serialized security origin of the frame that sent the
// message — see [OriginOpaque]. It has already been accepted by the
// view's [OriginPolicy]; it is reported so a handler shared between
// several trusted origins can still tell them apart.
Origin string
}
Message is one inbound communication from the page: a notification posted with window.bellui.post, or a request made with window.bellui.call.
Since: 1.0
type NavigationKind ¶
type NavigationKind int
NavigationKind says what started a navigation, so a policy can treat a link the user clicked differently from one the page started on its own.
Since: 1.0
const ( // often one the page started with script, or the initial load. NavigationOther NavigationKind = iota NavigationLinkClicked NavigationFormSubmitted NavigationBackForward NavigationReload )
func (NavigationKind) String ¶
func (k NavigationKind) String() string
String returns the kind's name, for logs and debugging.
type NavigationRequest ¶
type NavigationRequest struct {
URL string
Kind NavigationKind
// one inside an embedded frame.
MainFrame bool
// target="_blank" or window.open. This package has no second window to
// open it in, so an allowed one is loaded in this view instead; deny it
// to keep such links from replacing the current page.
NewWindow bool
}
NavigationRequest is a navigation the engine is about to start, offered to WebView.OnNavigate before it does.
Since: 1.0
type OriginPolicy ¶
OriginPolicy reports whether page content served from origin may use the bridge. It is consulted for every inbound message, including messages from sub-frames, so a page that navigates or embeds a third-party frame cannot widen its own access.
Since: 1.0
func TrustAllOrigins ¶
func TrustAllOrigins() OriginPolicy
TrustAllOrigins allows every page loaded in the view to use the bridge.
Use it only for content the app itself controls end to end. A view that can reach the open web — because it loads a remote URL, follows a link, or hosts a third-party frame — must not be given this policy: it would hand any page that turns up the same access to the app's WebView.Handle functions as the app's own content. Constrain what may be loaded with WebView.OnNavigate as well if the answer is not obviously "nothing else can be".
Since: 1.0
func TrustOrigins ¶
func TrustOrigins(origins ...string) OriginPolicy
TrustOrigins allows only the listed origins, compared exactly against the serialization described on OriginOpaque. Pass OriginOpaque to trust content loaded from a data: URL or about:blank, and "file://" to trust content the app loaded from disk.
Since: 1.0
type WebView ¶
type WebView struct {
// OnMessage is called when the page posts a one-way notification:
//
// window.bellui.post({hello: "world"})
//
// It runs on the main goroutine. It is only ever called while the bridge
// is enabled and the sending page passed the [OriginPolicy]; a message
// that arrives with no OnMessage set is dropped.
//
// Use [WebView.Handle] instead when the page expects an answer.
OnMessage func(Message)
// OnLoadChanged reports every change of [WebView.LoadState] for the main
// frame: a navigation starting, finishing, or failing. It runs on the
// main goroutine.
OnLoadChanged func(LoadEvent)
// start, and cancels it by returning false. A nil hook allows everything.
//
// It is the place to keep a view pinned to content you trust — pair it
// with the bridge's [OriginPolicy], which decides who may *talk* to
// bellui, where this decides who may be *shown*. It runs on the main
// goroutine and must return promptly: the engine is waiting on it.
OnNavigate func(NavigationRequest) bool
// contains filtered or unexported fields
}
WebView is a platform web engine hosted in a bellui layout. Create one with New and place it with NewHost (or hand it to widget.NewNativeViewHost yourself).
All methods must be called on the main goroutine.
Since: 1.0
func New ¶
New returns a web view that will load url once it is attached to a window. An empty url leaves the engine on a blank page.
Since: 1.0
func (*WebView) Attach ¶
Attach creates the platform web view inside the given window and loads the URL the view was created with, if any.
The bridge is installed here, so WebView.EnableBridge has to have been called first: a view attached with the bridge off has no page-side `window.bellui` object and no message channel behind it at all.
func (*WebView) BridgeEnabled ¶
BridgeEnabled reports whether WebView.EnableBridge has been called.
Since: 1.0
func (*WebView) Call ¶
Call invokes the page function registered with window.bellui.handle(name, fn) and reports its result to onResult, on the main goroutine. arg is marshalled to JSON, so values from outside the app cross as data and cannot become executable source in the page — prefer this to building a script with WebView.Eval.
onResult may be nil to ignore the answer. When it is not, it is called exactly once: with the page's resolved value, or with an error if the page rejected, has no handler by that name, or the view is not attached (ErrNotAttached) or has no bridge (ErrBridgeDisabled).
A page handler that never settles its promise leaves the callback pending until the view is destroyed, which fails it — the correlation is honoured, but the page's own liveness is the page's responsibility.
Since: 1.0
func (*WebView) CanGoBack ¶
CanGoBack reports whether there is an earlier entry in session history.
Since: 1.0
func (*WebView) CanGoForward ¶
CanGoForward reports whether there is a later entry in session history.
Since: 1.0
func (*WebView) Destroy ¶
func (w *WebView) Destroy()
Destroy removes the native view from the window and releases it.
Work still in flight is not left hanging: every pending WebView.Call and WebView.EvalResult callback is invoked with ErrNotAttached rather than never being called at all. Registered WebView.Handle functions are kept, so a view can be attached to another window and keep working; further calls into a destroyed view fail immediately with the same error.
func (*WebView) EnableBridge ¶
func (w *WebView) EnableBridge(policy OriginPolicy)
EnableBridge installs the page-side bridge, admitting only content that policy accepts. It must be called before WebView.Attach: the bridge is part of the web view's configuration, and a view attached without it has no window.bellui object and no message channel behind it — a page cannot reach bellui at all, rather than reaching it and being ignored. Calling it on an attached view is a logged no-op.
The bridge is off by default, and deliberately so. This package can show content the app did not write, and a message channel installed for a local trusted page is the same channel a remote page inherits when the user follows a link — the same stance widget.RichText takes with AllowRemoteContent, where parsed content is not trusted merely because it was rendered. A nil policy trusts nothing, which leaves the bridge present in the page but silent; use TrustAllOrigins or TrustOrigins to say what is trusted.
Since: 1.0
func (*WebView) Eval ¶
Eval runs JavaScript inside the page and discards its result.
js is source, so a caller that builds it by concatenating values from outside the app has an injection hole — a string with a quote in it becomes code. Prefer WebView.EvalFunc, which passes values as data, or WebView.Call, which hands them to a function the page registered.
It is a no-op when the view is not attached; use WebView.EvalResult to learn that instead.
func (*WebView) EvalFunc ¶
EvalFunc runs body as the body of a JavaScript function whose parameters are named by args, discarding the result.
The values in args are marshalled to JSON and passed to that function as data, never spliced into the source, so content from outside the app cannot become executable code in the page:
view.EvalFunc("document.title = title;", webview.Args{"title": userInput})
This is the injection-safe form of WebView.Eval and needs no cooperation from the page, unlike WebView.Call.
Since: 1.0
func (*WebView) EvalFuncResult ¶
EvalFuncResult is WebView.EvalFunc reporting the function's return value, with the result and error contract of WebView.EvalResult.
Since: 1.0
func (*WebView) EvalResult ¶
func (w *WebView) EvalResult(js string, onResult func(json.RawMessage, error))
EvalResult runs JavaScript inside the page and reports the value of its last expression to onResult, on the main goroutine.
The value arrives as JSON: a script evaluating to a number gives "42", to a string gives "\"hi\"", and to nothing gives "null". Decode it with encoding/json. onResult is called exactly once — with an error if the script threw, if its value cannot be represented as JSON, or if the view is not attached (ErrNotAttached).
The injection caveat on WebView.Eval applies here too.
Since: 1.0
func (*WebView) GoBack ¶
GoBack moves to the previous entry in session history, reporting whether there was one to move to.
Since: 1.0
func (*WebView) GoForward ¶
GoForward moves to the next entry in session history, reporting whether there was one to move to.
Since: 1.0
func (*WebView) Handle ¶
Handle registers fn as the answer to window.bellui.call(name, arg) in the page. Registering a nil function removes the handler. Handlers can be registered at any time; a request that arrives for a name with no handler rejects the page's promise with an error rather than hanging it.
Since: 1.0
func (*WebView) LoadHTML ¶
LoadHTML displays html directly, resolving the page's relative references against baseURL. An empty baseURL leaves the content with no origin of its own, which the bridge reports as OriginOpaque.
It is a no-op until the view is attached — unlike WebView.LoadURL, there is no pending-content slot; load the content from WebView.OnLoadChanged or after WebView.Attach returns.
Content loaded this way may not become a session history entry, so WebView.CanGoBack can still report false afterwards. That is the engine's own behaviour for literal content with no base URL — measured on WebKit — not something this package can arrange around; give the content a real baseURL, or serve it, if it has to be navigable.
Since: 1.0
func (*WebView) LoadState ¶
LoadState reports what the view's main frame is currently doing.
Since: 1.0
func (*WebView) LoadURL ¶
LoadURL navigates the view to url.
Before the view is attached the URL is only remembered, and is loaded as soon as it attaches; WebView.URL reports it either way.
func (*WebView) Post ¶
Post sends a one-way notification to the page, delivered to whatever the page assigned to window.bellui.onMessage. payload is marshalled to JSON, so it crosses as data and can never become executable source in the page.
It is the counterpart of WebView.OnMessage. Use WebView.Call when an answer is wanted.
Since: 1.0
func (*WebView) ResignFocus ¶
ResignFocus unfocuses the host, so keys stop reaching the page.
func (*WebView) SetGeometry ¶
SetGeometry is a no-op: the composited host is a real widget, so layout, clipping and scrolling reach the content without a platform call.
func (*WebView) SetVisible ¶
SetVisible drives CEF's WasHidden, which stops compositing while hidden.
func (*WebView) StopLoading ¶
func (w *WebView) StopLoading()
StopLoading stops a navigation in progress. A load stopped this way is reported to WebView.OnLoadChanged as failed with ErrNavigationCancelled.
Since: 1.0