-
-
Save runspired/b9fdf1fa74fc9fb4554418dea35718fe to your computer and use it in GitHub Desktop.
<!-- | |
<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> |
this helped me https://stackoverflow.com/a/63989246/10099510
I had the same problem it seems difficult to solve I found a solution To solve the problem the input in initialization must be equal to type="text" and then change to type="password" with the first focus or insert input
function changeTypeInput(inputElement){
inputElement.type="password"
}
<input type="text"
id="anyUniqueId"
onfocus="changeTypeInput(this)"
oninput="changeTypeInput(this)"
/>
@richlv: I would be completely satisfied if the browser WAITED WITH FILLING THE PASSWORD until user clicks on it.
(Which is actually what Firefox does ...)
@richlv: I would be completely satisfied if the browser WAITED WITH FILLING THE PASSWORD until user clicks on it.
(Which is actually what Firefox does ...)
Heya, if some browsers don't seem to work satisfactory, it might be best to report that to browser developers.
Heya, if some browsers don't seem to work satisfactory, it might be best to report that to browser developers.
That was great, thanks
None of the above solution worked for me in Chrome for Mac; in particular an input field generated by the "typeahead.js" library (that was not a password field) insisted to display the password suggestion when the field gets empty. At last I found that by simply putting the field inside a
tag makes it work, with no need to specify autocomplete=off in the field itself.With the reason for using the type="password" in mind: why not using type="text" and give it a font-family which makes the text unreadable? Like dots, or what ever.
<style>
input.key {
-webkit-text-security: disc;
}
</style>
<script>
var tagArr = document.getElementsByTagName("form");
for (let i = 0; i < tagArr.length; i++) {
tagArr[i].autocomplete = 'off';
}
var tagArrInput = document.getElementsByTagName("input");
for (let i = 0; i < tagArrInput.length; i++) {
tagArrInput[i].autocomplete = 'off';
if (tagArrInput[i].type == "password") {
tagArrInput[i].type = "text";
tagArrInput[i].classList.add("key");
}
console.log('name=', tagArrInput[i].name);
}
</script>
For everyone who may need it there is a library that was created to resolve this problem
https://github.com/noppa/text-security
This solution works for me well (I adapted it for jss)
{
password: {
fontFamily: 'text-security-disc',
WebkitTextSecurity: 'disc',
'&::placeholder': {
fontFamily: theme.typography.fontFamily,
}
}
}
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.
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.
Thank you very must