Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable autofill on a web form through HTML or JavaScript?

Tags:

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.

like image 915
at. Avatar asked Feb 25 '13 19:02

at.


People also ask

How do I turn off autofill in HTML?

Use the <input> tag with autocomplete attribute. Set the autocomplete attribute to value “off”.

Can I turn off autofill for a specific website?

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.

How do I stop autofill in Chrome using jquery?

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?

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.

How do I disable autocomplete of text in 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.

How do I autofill a form in Google Chrome?

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.

How do I enable autofill on my website?

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.


1 Answers

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" ); 
like image 101
LNendza Avatar answered Oct 16 '22 20:10

LNendza