Can webpage be aware of android virtual keyboard
android, browser, jquery, virtual-keyboard
Solution
From what I've seen, when the virtual keyboard pops up, the page is not resized (to fit the smaller view-area, visible with the virtual keyboard on). So this will not give your page a hint on whether the keyboard is up or not. And I don't really think there's another way of getting that info either.
You can make a setup where you look at the user agent, and if it's for an Android phone, when the user clicks various text input elements, you make some room at the bottom of the screen for the virtual keyboard.
For the size of the keyboard, the stock Android might have a standard size or ratio or percentage, but combined with the fact that there are a lot of Android mods out there plus the fact that there are multiple screen resolutions and screen ratios out there translates into not being able to have a fixed number for this (like keyboard is x pixels tall or y percent of screen estate). However, you can make a common sense assumption that it takes about half of the screen at the bottom.
So basically, using the user agent, screen resolution and the fact that the user has "clicked" on a text input field, you can get a decent idea of whether a virtual keyboard is displayed or not, and how much room to leave aside for it.
Problem
I have web page with jquery terminal and hidden textarea (that trigger Android Virtual keyboard), I can type characters but when I enter few commands the content is hidden behind Virtual Keyboard. Terminal content is scrolling to bottom because when I type some more command it's scrolling. When I use hardware keybaord in my phone scrolling is right (touch scroll is not working yet). I added this CSS ``` .terminal textarea { top: 0; width:0; margin-left: -8px; pointer-events: none; } ``` to prevoius ``` .terminal .clipboard { position: absolute; bottom: 0; left: 0; opacity: 0.01; filter: alpha(opacity = 0.01); filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.01); width: 2px; } .cmd > .clipboard { position: fixed; } ``` and have this code in plugin (textarea was used for clipboard). ``` self.click(function() { self.find('textarea').focus(); }); ``` And my qestion is this: can javascript detect how big Virtual Keyboard is? Or maybe there is other way to change the size of the webpage so it's be only in visual part (not where keyboard is)? Or maybe something is wrong with my code, it was not designed to work on mobile. Does the size of the keyboard is always the same, even if user install different one?