Skip to main content

WebView

The WebView widget embeds a web browser area inside an app screen to display web pages and HTML content.
It loads a URL, an in-app asset path, or inline HTML data, and it passes data back and forth between the page and the app.

Definition and role

The WebView widget renders the content you specify in an embedded browser. The widget's type decides how that content is read — as a URL, an asset path, or inline HTML data. Set scrollbar visibility, loading bar visibility, a custom User-Agent, and scroll forwarding to the parent (macOS). From a script, run the page's JavaScript or exchange data with the page.

  • Category: Contents
  • Default type: url
  • Default size (Sized Box): 100 x 100

Features

FeatureDescription
Load contentLoads a URL, an app asset path, or inline HTML depending on the type (url, assetpath, or data).
Page load notificationReports the end of page loading through the onFinished event.
Page-to-app communicationReceives messages the page sends over the hybrid:// bridge through onShouldOverrideUrl and onReceiveData, and sends data to the page with sendDataToWeb.
JavaScript executionRuns JavaScript inside the page with runJavaScript and asyncRunJavaScript.
Display settingsSets the vertical and horizontal scrollbars, loading bar visibility, and a custom User-Agent.

How to use

  1. Open the Contents category in the left widget palette.
  2. Drag and drop the WebView item onto the canvas.
  3. In the Properties panel on the right, select a type (url, assetpath, or data) and enter the address, path, or HTML to load in value.
  4. Adjust the scrollbars (verticalScrollBarEnabled, horizontalScrollBarEnabled), the loading bar (showLoadingBar), the User-Agent (userAgent), and other settings as needed.

Properties

PropertyDescriptionDefaultValue / Type
typeHow value is readurlurl, assetpath, data
valueThe content to load — a URL, asset path, or HTML, depending on the typeEmptyString
userAgentA custom User-Agent appended after the default oneEmptyString
verticalScrollBarEnabledWhether the vertical scrollbar appearstrueBoolean
horizontalScrollBarEnabledWhether the horizontal scrollbar appearstrueBoolean
embedInParentScrollForwards trackpad and mouse wheel scrolling to the parent scroll view (macOS only; ignored on other platforms)falseBoolean
showLoadingBarWhether a loading bar appears while the page loadstrueBoolean

Notes and tips

note

When value is empty, no content loads. Enter the URL, asset path, or HTML string exactly as the type requires.

tip

embedInParentScroll works on macOS only. Turn it on when you place a WebView inside a scroll view so trackpad and wheel scrolling reaches the parent — other platforms ignore it.

Learn more

tip

For the full set of Widget Controls (Property, Method, and Event) that script this widget, see WebView Widget Control.