Webview
self:eval
Client
Evaluates a JavaScript expression inside the webview
Syntax
local status = self:eval(input)Parameters
| Type | Name | Description |
|---|---|---|
string | input | JavaScript code to evaluate inside the webview |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, or false on failure |
Examples
local browser = webview.create()
--Change the page background color
browser:eval("document.body.style.background = 'red'")
--Post a message back to Lua
browser:eval("window.ipc.postMessage('hello from JS')")