Webview.constructor(parent, url, [ x ], [ y ], [ width ], [ height ]) constructor


The Webview constructor returns a Webview instance representing a Microsoft Edge Webview2 component.

Parameters

parent

An object that will own the Webview. Parent objects can be any of Window, Groupbox, TabItem and Panel

url

A string representing the URL that the Webview widget will navigate too once initialized.

x

An optional number that indicates the Webview horizontal position, in pixels. Zero means the left border of the parent.

y

An optional number that indicates the Webview vertical position, in pixels. Zero means the top border of the parent.

width

An optional number that indicates the Webview width in pixels, autosized to fit text content if omitted.

height

An optional number that indicates the Webview height in pixels, autosized to fit text content if omitted.

A just constructed Webview widget does not mean it is ready to be used.
In particular, during the widget construction process, it can be displayed while it is still initializing.
Once initialized, the Webview widget will throw a Webview.onReady() event, particularly useful to start using the Webview widget.

Example

local ui = require "ui" require "webview" -- create a simple Window local win = ui.Window("Webview.constructor() sample", 320, 200) -- create a Webview on this window local Webview = ui.Webview(win, "https://www.luart.org") Webview.align = "all" win:show() -- update the user interface until the user closes the Window repeat ui.update() until not win.visible