Created
May 23, 2016 13:46
-
-
Save runspired/b9fdf1fa74fc9fb4554418dea35718fe to your computer and use it in GitHub Desktop.
How to turn off password and email/username autocomplete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
<form autocomplete="off"> will turn off autocomplete for the form in most browsers | |
except for username/email/password fields | |
--> | |
<form autocomplete="off"> | |
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields --> | |
<input id="username" style="display:none" type="text" name="fakeusernameremembered"> | |
<input id="password" style="display:none" type="password" name="fakepasswordremembered"> | |
<!-- | |
<input autocomplete="nope"> turns off autocomplete on many other browsers that don't respect | |
the form's "off", but not for "password" inputs. | |
--> | |
<input id="real-username" type="text" autocomplete="nope"> | |
<!-- | |
<input type="password" autocomplete="new-password" will turn it off for passwords everywhere | |
--> | |
<input id="real-password" type="password" autocomplete="new-password"> | |
</form> |
That worked for me and my friend (@amandasantiagu), we are using the latest Chrome version 94.0.4606.81
We used it in React and it worked perfectly
<form autocomplete="off" style="100%">
<input autocomplete="false" type="search" style=" overflow: hidden; display: none " />
<input autocomplete="new-password">Your input info here </input>
</form>
use 'novalidate' on the form element
https://www.w3schools.com/tags/att_form_novalidate.asp
help me for this type for special password
If you want to prevent the browser's password manager from autofilling, check out @krozamdev/masked-password. It helps hide password inputs from autofill detection.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One thing that worked for me was to use httprequest to register users, I had to remove the password elements before calling location.href. No idea if it works in chrome. Browsers getting smarter so I guess it is just a question of time before this no longer works.