Prevent browser from remembering credentials (Password)

Danny22 picture Danny22 · Jul 15, 2015 · Viewed 24k times · Source

Is it possible after processing any login Form to prevent the browser from offering the option to remember the password?

I know it's been asked and answered here but none of the answers have worked so far, even one of them suggested using:

autocomplete="off"

But that also didn't worked.

I'm using AngularJS and Jade as templating engine (not sure if relevant or not anyhow), is there any way to do this?

Answer

Preston Van Loon picture Preston Van Loon · Jul 15, 2015

if a site sets autocomplete="off" for a form, and the form includes username and password input fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits this page.

https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion

You should also set autocomplete="off" on your input as well as your form.

Google Chrome release notes:

The Google Chrome UI for auto-complete request varies, depending on whether autocomplete is set to off on input elements as well as their form. Specifically, when a form has autocomplete set to off and its input element's autocomplete field is not set, then if the user asks for autofill suggestions for the input element, Chrome might display a message saying "autocomplete has been disabled for this form." On the other hand, if both the form and the input element have autocomplete set to off, the browser will not display that message. For this reason, you should set autocomplete to off for each input that has custom auto-completion.