Skip to content

Instantly share code, notes, and snippets.

@abdulloooh
Last active May 10, 2020 07:45
Show Gist options
  • Save abdulloooh/e9d4078a2bb7467fda06d19afc0985b1 to your computer and use it in GitHub Desktop.
Save abdulloooh/e9d4078a2bb7467fda06d19afc0985b1 to your computer and use it in GitHub Desktop.
Disable modern browsers from offering autofill and autocomeplete to your input forms

Disable HTML form autocompletion

It is common that when you build a user form, it tends to auto-fill particularly when a user has signed up or logged in on a browser before and saved the password in the browser.

Common approach is to set autocomplete="off" but this doesn't work in modern browsers anymore for all input field; instead, in password input field that is with type="password" inside form tag,
set autocomplete="new-password" and that will work.

  <form>
   <input type="password" autocomplete="new-password" />
   ...

This is going to prevent Chrome and Firefox to offer autofill and autocomplete for all input fields inside that form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment