Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to prevent Android Firefox browser to resize window when soft keyboard is on

Hello to my fellow developers.

I'm building a web application and I'm having problems with Firefox browser on Android. When I click to a text field, the soft keyboard pops up and it resizes my whole window, destroying my css layout.

I managed to overcome this problem with Android Chrome, with the following script:

var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width,height='+window.innerHeight+', initial-scale=1.0';
document.getElementsByTagName('head')[0].appendChild(meta);

However, it seems that Firefox browser is not following the above and keeps resizing my window.

Please, don't confuse my question with a native android application, I'm talking about a web application, just HTML, CSS, JavaScript

Thank you all for your time.

like image 609
Panos Vakalopoulos Avatar asked Mar 03 '16 10:03

Panos Vakalopoulos


1 Answers

<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
like image 105
Pogromca Motyli Avatar answered Nov 13 '22 23:11

Pogromca Motyli