HTML5 input on mobile

There is no way to implement gui.show_keyboard() because of browser limitations.
But I found a nice workaround for keyboard input in html5 builds.

It is possible to show a native popup with input request using this method:

M.get_input(explanation, default_text)
 if html5 and is_html5_mobile() then --is_html5_mobile()  is your way to check if it's mobile html5
        local result = html5.run("window.prompt('".. explanation.."', '".. default_text.."')")
        if result ~= "null" then
            return result
        end
    end
end

iOS:

Android:

20 Likes