Webview:goback() method
Navigates to the previous web page.
Return value
This function returns no value.Example
local ui = require "ui"
require "webview"
-- create a simple Webview
local win = ui.Window("Webview:goback() sample", 640, 480)
local addressbar = ui.Entry(win, "", 24, 5, 592, 24)
local prevBtn = ui.Button(win, "\xe2\x87\xa6", 0, 3, 16, 16)
prevBtn.font="Lucida Console"
prevBtn.fontsize = 12
prevBtn.fontstyle = { bold = true }
local nextBtn = ui.Button(win, "\xe2\x87\xa8", 616, 3, 16, 16)
nextBtn.font="Lucida Console"
nextBtn.fontsize = 12
nextBtn.fontstyle = { bold = true }
local Webview = ui.Webview(win, 0, 30, 640, 430)
function prevBtn:onClick()
if Webview.cangoback then
Webview:goback()
end
end
function nextBtn:onClick()
if Webview.cangoforward then
Webview:goforward()
end
end
function addressbar:onSelect()
Webview.url = addressbar.text
end
-- Set current window title with the page title, once loaded
function Webview:onLoaded()
win.title = Webview.title
addressbar.text = Webview.url
end
win:show()
-- update the user interface until the user closes the Webview
repeat
ui.update()
until not win.visible