Jump to content

Bringing up mobile keyboard in HTML5 game


richpixel
 Share

Recommended Posts

Hello

 

My question is basically the same as this one I found on stackoverflow:

http://stackoverflow.com/questions/21406781/how-can-i-bring-up-the-keyboard-on-mobile-devices-to-catch-the-input-for-drawing?lq=1

 

Is it possible to bring up the native keyboard on mobile - iOS and Android - to accept user input for an HTML5 canvas game? So - to do it without any <input> elements? Just somehow make the keyboard come up and get access to text the user types.

 

 

Link to comment
Share on other sites

I'd echo what Rich has said and add that the keyboard on iOS (particularly 7) is a fickle little beast.

 

I actually found that in my case the input had to be visible (although it could be offscreen) but I think it had to do with other things going on at the same time in my scenario.  Infact, I found it impossible to get absolutely consistent results.

 

Similarly, dismissing it can be a bit of an issue.  I had to focus on an anchor tag (again, this may be scenario specific but it gave the most consistent results).

 

You'd have to be careful with the perfomance implications but you can create, focus and then remove the element in the same tick and that should give you a bit of control over the keyboard.  It is a hack but I spent a bit of time on this and found little info from apple on how it should be done.

 

Note: I only focussed on ios so android might have a better solution.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...