richpixel Posted February 24, 2014 Share Posted February 24, 2014 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. Quote Link to comment Share on other sites More sharing options...
rich Posted February 25, 2014 Share Posted February 25, 2014 As far as I'm aware it's impossible to do it without using an input element. The input element doesn't have to be visible, but it has to exist in the dom and gain focus. richpixel 1 Quote Link to comment Share on other sites More sharing options...
mattstyles Posted February 25, 2014 Share Posted February 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.