Is there a way to disable autofill in Chrome and other browsers on form fields through HTML or JavaScript? I don't want the browser automatically filling in answers on the forms from previous users of the browser.
I know I can clear the cache, but I can't rely on repeatedly clearing the cache.
Use the <input> tag with autocomplete attribute. Set the autocomplete attribute to value “off”.
Actually you can disable the autofill for usernames and passwords for just one site. Go to settings in the Chrome browser then to passwords. Scroll down to find the website that you do not want autofilled. Then you hit on the 3 dots and remove it from the list of saved passwords.
Sept 2020: autocomplete="chrome-off" disables Chrome autofill. Original answer, 2015: For new Chrome versions you can just put autocomplete="new-password" in your password field and that's it. I've checked it, works fine.
How to prevent HTML form input autofill? The HTML form inputs can have the autocomplete="off" attribute set to prevent automatically filling of such input. However most browsers tend to ignore this attribute, due to annoying designs of many web applications, which are forbidding saving passwords on logins forms.
This allows the browser to offer autocompletion (i.e., display possible completions for the fields where the user has started typing) or autofill (i.e., pre-populate some fields on load). To disable the autocomplete of text in forms, use the autocomplete attribute of <input> and <form> elements. You'll need the "off" value of this attribute.
In Google Chrome, the autofill feature can populate three types of forms or fields: passwords, credit card information, and addresses. The following sections show you how to access each, and enable or disable them. Open the Google Chrome browser. Click the icon in the upper-right corner of the browser window.
Click the icon in the upper-right corner of the browser window. In the drop-down menu that appears, select Settings. On the left side of the screen, click the Autofill selector. In the middle of the screen, under the Autofill section, you are presented with three choices: Passwords, Payment methods, and Addresses and more.
You can do it at the input level in HTML by adding autocomplete="off"
to the input.
http://css-tricks.com/snippets/html/autocomplete-off/
You could also do it via JS such as:
someForm.setAttribute( "autocomplete", "off" ); someFormElm.setAttribute( "autocomplete", "off" );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With