Get mobile keyboard with html5


I am developing my game for mobile html5.

I need an input field where the player enters his name. I am using the DirtyLarry lib and it’s working on desktop browser, but on mobile the device keyboard is not shown…

Tried to use gui.show_keyboard() but it does not seem to help.

Is this even possible?

Look Your Loot aka Hamster

The gui.show_keyboard() is for the devices themselves (iPhone, Android), not the browser (HTML5).
This could of course be more clearly stated in the documentation (I’ve added a ticket for it)


Thought so…

So any idea what might be done for html5 keyboard on mobile?


Defold isn’t optimized for mobile HTML5. It will be slow no matter what you do…

When HTML5 target gets native extensions it will probably be easy to add support for this.

You could probably implement a simple virtual on screen in game keyboard too.


I actually found that it is working nicely for simple games on mobile html5…

Anyways, too bad there is no way to show the keyboard. :disappointed_relieved:


What type of device are you testing on? Don’t worry the good solution will probably come as soon as native extensions for HTML5 are released!


Tested it on Nexus 5x, iPhone 5S, Samsung S6, Xiaomi Redmi Note 3
Working fine on all those


Would you be willing to post links to any of your projects? How simple are you talking?


Can’t post links yet since no game is live.
By simple I am talking about platformers with spine animations and some particles


Did you manage to find a solution for this?


Someone motivated could make a Native Extension for this.


How would the extension? Would it be a html5 extension that can all up the android keyboard? Any pointers would be helpful…
I tried modding the example android extension to call up a keyboard (InputMethodManager) but it still didn’t work on mobile html5


For mobile keyboard you have to create an input field and then give it focus, then get the text entered to it. If you search like “html5 game mobile keyboard input” you can find examples. Then you want to have a function to deal with this text input in your game and close the input focus when entered. You probably don’t even need a NE for this it might be more easily doable with and then polling a listener on update while waiting for input. If you’re not experience with JS this might be harder for you but try to look up examples and see if you can get it working on your own first.