webview:message

Client

Fired when a webview receives an IPC message from its page


Signal

"webview:message"

Arguments

TypeNameDescription
userdatawebviewThe webview instance that received the message
stringmessageThe raw message string sent from the page

This is the primary IPC channel between a webview page and Lua.

  • Messages are sent from the page via window.ipc.postMessage(message).
  • The message is a raw string — parse it as JSON if structured data is needed.

Example

Handle a message from a webview page
util.event.on("webview:message", function(webview, message)
    core.engine.print("info", "Webview message:", message)
end)
Parse a JSON message
util.event.on("webview:message", function(webview, message)
    local data = util.table.decode(message)
    if data and data.action == "ready" then
        core.engine.print("info", "Page is ready")
    end
end)

On this page