android - 关闭网站上密码字段的预测文本

标签 android html keyboard autocorrect

我有一个 Android 应用程序,它在 webview 中显示一个页面来处理用户名/密码登录。我发现对于某些键盘(例如三星 Jellybean 设备上的标准键盘),预测文本会更改用户在密码字段中键入的内容。

例如,如果密码是“ab!d”,预测文本会尝试通过在标点符号后自动输入一个空格来提供帮助,使其成为“ab!d”,并导致输入错误的密码。我知道预测文本背后的唯一原因是,当通过键盘菜单设置关闭预测文本时,不会发生此问题。

有没有办法在网络表单中输入时禁用预想文本?我已经将输入类型设置为“密码”以屏蔽条目。这不是一个 Android TextView(它是一个 HTML 输入),所以我没有输入的平台级控件,据我所知,Android 不理解某些网站使用的“autocorrect=off”设置在 iOS 设备上解决这个问题。

我注意到这个问题似乎并没有发生在其他网站上,比如 mail.google.com。相同的键盘,无论设置如何,都会礼貌地将用户的输入留在密码字段中。查看该页面上的 HTML 源代码并没有发现密码字段有任何特殊之处,只有我已经使用的相同输入类型。

你们有没有遇到过这个问题,或者你们能想到可能的解决方案吗? mail.google.com 或其他网站是否有我遗漏的内容?任何帮助将不胜感激。

HTML 示例如下:

<div data-role="fieldcontain" class="ui-hide-label"  >
<label for="USER">ID</label>
<input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"  type="text" name="USER" id="USER" value="" maxlength="50" placeholder="${userId_text}" data-theme="c"/>
</div>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="password">Password</label>
<input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"  type="password" name="password" id="password" value="" maxlength="50" placeholder="Password" data-theme="c"/>
</div>

enter image description here

最佳答案

根据 Disable Autocomplete, Autocapitalize, and Autocorrect , 有几个不同的属性可以尝试。

<input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />

另外,回答 Turning off auto-complete for textarea and inputfields in Android Cordova-app建议<input name="password>是解决方案。奇怪的是 type=password不起作用。

关于android - 关闭网站上密码字段的预测文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15298890/

相关文章:

html - CSS页脚,留在页面底部而不是屏幕底部

keyboard - XCode 6.1 iOS 8键盘十进制垫不正确

iOS UITextInput 控件 : Receiving forward-delete key from hardware keyboard

android - AQuery 从图库中选择图像

html - 在一个 div 中并排对齐三个图像,一次显示一个图像并隐藏两个

android - 在 Samsung Galaxy S6 edge 上添加 Realm 和 SQLCipher 时应用程序崩溃

javascript - 使用 jQuery AJAX 请求 - POST 到 php

javascript - jQuery 中的全站导航,但在 Mac 上避免使用 Command-

Android Recyclerview 与 ListView 与 Viewholder

android - 所有安装 Android Froyo 2.2(API 8) 的设备都支持 OpenGL ES 2.0 吗?