Webview:loadstring(html) method


Load the specified HTML content as a new document.

Parameters

html

A string that contains the HTML content to be loaded.

Return value

This function returns true if the operation was successful or false otherwise.

Example

local html = [[ <!DOCTYPE html> <html> <body> <center><h1 id="text" style="margin-top:30%">Hello from <font color="#283593">Lua</font><font color="#FF9800"><sup>rt</sup></font></h1></center> </body> </html>]] local ui = require "ui" require "webview" -- create a simple Webview local win = ui.Window("Webview:postmessage() sample", 640, 480) local Webview = ui.Webview(win, 0, 50, 640, 430) Webview.align = "all" -- once ready, load the html content from string function Webview:onReady() Webview:loadstring(html) end -- update the user interface until the user closes the Window ui.run(win):wait()