当软键盘打开时,如何防止Android Firefox浏览器调整窗口大小 [英] how to prevent Android Firefox browser to resize window when soft keyboard is on
本文介绍了当软键盘打开时,如何防止Android Firefox浏览器调整窗口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
向我的其他开发人员问好.
Hello to my fellow developers.
我正在构建一个Web应用程序,但是在Android上使用Firefox浏览器时遇到了问题.当我单击一个文本字段时,软键盘弹出,它调整了整个窗口的大小,破坏了CSS布局.
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.
我设法使用以下脚本通过Android Chrome解决了这个问题:
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);
但是,似乎Firefox浏览器未遵循上述要求,并一直在调整窗口大小.
However, it seems that Firefox browser is not following the above and keeps resizing my window.
请不要将我的问题与本地android应用程序混淆,我所说的是Web应用程序,只是HTML,CSS,JavaScript
谢谢大家的光临.
推荐答案
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
这篇关于当软键盘打开时,如何防止Android Firefox浏览器调整窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文