How to disable chrome's autofill with javascript or in HTML

41,809 views
Skip to first unread message

Nadine Cilliers

unread,
Sep 3, 2015, 4:05:14 AM9/3/15
to Chromium-discuss
Hi,

I need to know how to disable the auto-fill function in chrome from within code. The reason is that if a user uses auto-fill the field values aren't sent when a form is submitted. 

I have searched the web and found only that <input autocomplete="off"> or <form autocomplete="off" should work but it doesn't. Alternatively I found that you should use <input autocomplete="false"> but that fails as well.

Assistance would be greatly appreciated.

Kind regards
Paul

PhistucK

unread,
Sep 3, 2015, 4:15:07 AM9/3/15
to nadinec...@gmail.com, Chromium-discuss
You cannot. You better just change your code not to rely on keypress, focus, blur and such.


PhistucK

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

Nadine Cilliers

unread,
Sep 3, 2015, 4:21:43 AM9/3/15
to Chromium-discuss, nadinec...@gmail.com
Thanks for the reply.

Is there a reason why when only using autofill to complete a field the value is not posted on form submission? The values only go through when you type a value into the field.

PhistucK

unread,
Sep 3, 2015, 4:50:32 AM9/3/15
to nadinec...@gmail.com, Chromium-discuss
Like I mentioned (and especially without a URL to reproduce), the code probably expects certain events to fire, that the browser does not fire when autofilling, like keypress, keyup, keydown, focus, blur and more.


PhistucK

Nadine Cilliers

unread,
Sep 6, 2015, 7:48:28 AM9/6/15
to Chromium-discuss, nadinec...@gmail.com
Thanks a lot! I will see what happens if I manually trigger those events and hopefully that will resolve the initial issue.

Best regards

Hitesh Kalwani

unread,
Oct 21, 2016, 5:56:46 PM10/21/16
to Chromium-discuss, nadinec...@gmail.com
autocomplete="new-password"

Nance, Aaron

unread,
Oct 21, 2016, 6:01:57 PM10/21/16
to hiteshka...@gmail.com, Chromium-discuss, nadinec...@gmail.com

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discuss+unsubscribe@chromium.org.



--

Aaron Nance

Software Developer

Assessment & Instruction

Pearson


E: aaron...@pearson.com


Pearson

Always Learning

Learn more at www.pearsonk12.com

Bhargav Bhuva

unread,
Jan 5, 2018, 6:18:27 AM1/5/18
to Chromium-discuss, nadinec...@gmail.com
Please Use  autocomplete="new-username" that could work nice


On Thursday, September 3, 2015 at 1:35:14 PM UTC+5:30, Nadine Cilliers wrote:

dec...@decook.net

unread,
Jan 7, 2018, 2:01:36 AM1/7/18
to Chromium-discuss, nadinec...@gmail.com
Hey Bhargav,

Are you using that in the form tag or the input tag, It doesn't seem to work for me in ever place. I'm testing it in chrome 63.0.3239.108 (Official Build) (64-bit).

i have also tried changing the name and ID of the field on focus and changing it back on blur, it didn't work... makes me wonder how chrome even knows its the same field.

Thanks
Dylan

Lin Terry

unread,
Mar 29, 2018, 1:46:59 AM3/29/18
to Chromium-discuss, nadinec...@gmail.com
Use jQuery disableAutoFill plugin

$('#login-form').disableAutoFill();

Document:

Demo:


Nadine Cilliers於 2015年9月3日星期四 UTC+8下午4時05分14秒寫道:

Jonas Vercammen

unread,
Apr 18, 2019, 4:43:19 AM4/18/19
to Chromium-discuss, nadinec...@gmail.com, terrylin....@gmail.com
Thanks man!
I only re-used the:
 Math.random().toString(36).replace(/[^a-z]+/g, '');
From that lib to randomise the name of an input element to disable autocomplete. And it works!

Thanks for referring to that github and solution.

Op donderdag 29 maart 2018 07:46:59 UTC+2 schreef Lin Terry:
Reply all
Reply to author
Forward
0 new messages