iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?

Posted by LKM on Stack Overflow See other posts from Stack Overflow or by LKM
Published on 2010-04-07T14:12:24Z Indexed on 2010/04/08 9:33 UTC
Read the original article Hit count: 936

Filed under:
|
|
|
|

I'm writing a web app for the iPad (not a regular App Store app - it's written using HTML, CSS and JavaScript). Since the keyboard fills up a huge part of the screen, it would make sense to change the app's layout to fit the remaining space when the keyboard is shown. However, I have found no way to detect when or whether the keyboard is shown.

My first idea was to assume that the keyboard is visible when a text field has focus. However, when an external keyboard is attached to an iPad, the virtual keyboard does not show up when a text field receives focus.

In my experiments, the keyboard also did not affect the height or scrollheight of any of the DOM elements, and I have found no proprietary events or properties which indicate whether the keyboard is visible.

© Stack Overflow or respective owner

Related posts about ipad

Related posts about safari