Turn off predictive text for password field on websites

user2149114 picture user2149114 · Mar 8, 2013 · Viewed 11.5k times · Source

I have an Android application that displays a page in a webview to handle a username/password login. I have found that with certain keyboards (like the stock keyboard on Samsung Jellybean devices), the predictive text is changing what the user types in the password field.

For example, if the password is "ab!d", the predictive text tries to help by automatically entering a space after the punctuation, making it "ab! d" and causes an incorrect password to be entered. The only reason I know that predictive text is behind this is that this problem does not occur when predictive text is turned OFF through the keyboard menu settings.

Is there a way to disable the predictive text when typing in the web form? I already have the input type set to "password" to mask the entry. This is not an Android TextView (it is an HTML input), so I don't have the platform level controls on the input, and as far as I know, Android does not understand the "autocorrect=off" setting that some sites use to tackle this problem on iOS devices.

I have noticed that this problem does not seem to happen on other websites like mail.google.com. The same keyboard, regardless of settings, will politely leave the user's input alone on the password field there. Looking through the HTML source on that page did not reveal anything special on the password field, only the same input type that I already use.

Have any of you run into this problem, or can you think of possible solutions? Is there something that mail.google.com or other sites do that I am missing? Any help will be greatly appreciated.

Sample of the HTML is below:

<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>

Answer

Kevin Hakanson picture Kevin Hakanson · Mar 10, 2013

According to Disable Autocomplete, Autocapitalize, and Autocorrect, there a few different attributes to try.

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

Also, and answer to Turning off auto-complete for textarea and inputfields in Android Cordova-app suggests that <input name="password> is the solution. It's odd that type=password doesn't work.