Disable autocomplete in chrome 66
Disable autocomplete in chrome 66
Is there any way to disable autocomplete on a text field in chrome 66?
I have tried a number of options like :
Can anyone help me with this?
Also, one more thing does chrome automatically enables autocomplete for a username if it has a password type field below it?
No it's not, autofill is for password fields and autocomplete is for text fields. Also this is specifically for new version of Chrome which broke everything that used to work. See bugs bugs.chromium.org/p/chromium/issues/detail?id=587466 bugs.chromium.org/p/chromium/issues/detail?id=840820
– SSH
May 22 '18 at 1:01
Are you having problems with the username and password field automatically filling up? Take a look at my answer here to see if the issue is the same.
– Keale
May 29 '18 at 1:06
7 Answers
7
I used this code and it is working for me. I hope it will also helpful for you. :)
Enter your type with readonly and then below mention code.
<input readonly type="email" onfocus="if (this.hasAttribute('readonly'))
this.removeAttribute('readonly');
this.blur(); this.focus(); " />
Thanks for the answer, Durgesh. But this does not seem to be working:( Can this be because of the autofocus attribute on this particular field?
– Aman Srivastava
May 25 '18 at 11:42
Yes you need to add with particular field. Replace your type to read only type with rest of the code. For example you input type=“email” then readonly type=“email” and for password “pass”
– Durgesh Dangi
May 26 '18 at 13:13
No, I don't think you got my question. I have autofocus enabled on the field. So can the autofocus attribute cause problem when I try your logic?
– Aman Srivastava
May 27 '18 at 7:12
A lot of browsers refuse to adhere to what you have mentioned - the best way is to make an element readonly
and then on hover/click/blur/focus, remove readonly
.
readonly
readonly
So you could give it a class such as disable_autocomplete and also make the input field readonly.
Then when the field is hovered, focussed, or clicked you can remove readonly. Optionally, add it back when unfocussed.
I think you mean to say the same thing which Durgesh mentioned. But as I have already mentioned, this does not seem to work.
– Aman Srivastava
Jun 15 '18 at 8:11
$(document).ready(function()
$("input").val("");
);
So, Chrome just sets the value of element when autofilling them. Just try that, else you can try set some interval, wich will check value in HTML code, because Chrome not put new value to HTML code, just puts it in memory for itself.
I acheived the auto complete functionality to be disabled in chrome by giving
<form autocomplete="off">
and
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
element.autocomplete = isChrome ? 'disabled' : 'off';
where isGoogleChrome is a function to find whether the browser is chrome written with help of this post.
JavaScript: How to find out if the user browser is Chrome?
Does not work in Chrome
– Prisoner ZERO
Dec 20 '18 at 19:19
@PrisonerZERO i had updated the snippet to make your job easier
– Samuel J Mathew
Dec 24 '18 at 5:27
Use this
$(document).ready(function()
$("input").attr("autocomplete", "off");
);
$(document).ready(function()
$("input").attr("autocomplete", "off");
);
And if the autofill is enabled in chrome you can follow these steps to turn it off:
Turning Off Autofill in Chrome
Hi Nitin,thanks for your answer. But your answer does not solve my problem as I can not follow the steps mentioned by you for turning off autofill as the website is client facing, so I can not go around turning off autofill for all the clients.
– Aman Srivastava
Jun 5 '18 at 16:57
Check out the newest version of Chrome V.67. They have fixed that issue.
Issue persists in the latest version too.
– Aman Srivastava
Jun 13 '18 at 12:34
There is my solution, i'll put a link to my stack overflow answer to a similar problem.
Disable chrome from autocomplete/suggestions using jQuery
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Possible duplicate of Disabling Chrome Autofill
– mahdi motamedi
May 18 '18 at 6:36