Disable autofill in Chrome 63

HtmlGoogle Chrome

Html Problem Overview


I just updated my browser to Chrome Version 63.0.3239.84 (Official Build) (64-bit).

I then proceeded to go on my website, where I have a input box with autocomplete='off', yet I still get the following:

enter image description here

(You can see my inbuilt suggestion dropdown below it)

This never used to be the case. Nothing else has changed!

Why is this happening? Is this a bug in the new version of chrome? I have tried all other suggestions like autocomplete="false" or applying autocomplete=off to the form too. I have even tried to apply these with jquery after the page has loaded but also no luck.

I have tested this on multiple machines with the newest version of chrome on different operating systems. The issue persists.

Html Solutions


Solution 1 - Html

Update Apr 2021:

Chrome and Firefox support autocomplete="off"

Safari continues to ignore autocomplete="off" and as far as I know there's no good solution fore Safari except to obfuscate the field name.

Update Feb 2018:

Thanks to @JamesNisbet for pointing this out in the comments.

According to the Chrome team, autocomplete="off" and autocomplete="false" will be ignored moving forward. This is not a temporary regression in Chrome.

Chrome will attempt to autofill any form fields that follow the WHATWG standard on autocomplete. With one exception, they ignore "off" and "false" values.

In summary, to disable autofill, use the autocomplete attribute with a value that is not on the WHATWG list.

Make your case why you think autocomplete="off" should not be ignored by Chrome in this Chromium thread.


Looks like a possible regression in Chrome 63. In Chrome's original autofill documentation:

> In the past, many developers would add autocomplete="off" to their form fields to prevent the browser from performing any kind of autocomplete functionality. While Chrome will still respect this tag for autocomplete data, it will not respect it for autofill data. So when should you use autocomplete="off"? One example is when you've implemented your own version of autocomplete for search.

https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill

They do make a distinction between autocomplete and autofill, although it's not clear they are different.

Chrome, Safari, and Edge are all attempting to implement autofill but there is no clear standard. They look at the name attribute rather than an explicit, standardized attribute.

For now autocomplete="something-new" is a good workaround, although syntactically it makes no sense. This seems to work because the browser can't understand it.

Solution 2 - Html

We tried autocomplete="false" and autocomplete="off", neither work. But something Chrome doesn't understand, like autocomplete="disabled", does seem to work. Strange!

Update: this is working as of Chrome 72.

Solution 3 - Html

2019 It seems autocomplete="disabled" works again as of Chrome 72.


SINCE A LOT OF PEOPLE HAVE BEEN DOWNVOTING WITHOUT READING THE COMMENTS: THIS NO LONGER WORKS IN CHROME AS OF 2018 / CHROME 63+ relevant: https://bugs.chromium.org/p/chromium/issues/detail?id=587466

Having autocomplete="false" instead of autocomplete="off" works, you can read more from the Chrome team as to why they did it


here:

https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands https://bugs.chromium.org/p/chromium/issues/detail?id=468153 https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/zhhj7hCip5c https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill

Solution 4 - Html

Looks like chrome looks for the closest "label" html tag to the input, and analyzes the label's value/html to affect the input's autofill.

The cleanest workaround I found to disable the input's autofill was this:

<label for="">Country</label>
<label for="" style="display: none;">hidden label to mislead chrome autocomplete</label>
<input ... />

Solution 5 - Html

I've managed to get a working "hack" in Chrome Version 65.0.3325.162 (Official Build) (64-bit).

I have to render an input field - hidden so it doesn't affect my page:

<input style="display:none;"/>

Then I render my password input field:

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

So my form ends up looking like:

<form>
	<input style="display:none;" />
	<input type="password" autocomplete="new-password" />
	<input type="submit" />
</form>

Importantly, you cannot add a name or an id attribute to your password type input element, and you must have autocomplete="new-password"

Solution 6 - Html

After Chrome 63 it looks like they changed it to autocomplete="disabled"

I recommend you get a browser detecting library and for the rest of it use autocomplete="off"

Solution 7 - Html

As Chrome is never going to work properly and/or keeps changing its mind (I know its not human) the simplest solution to ensure autofill/autocomplete stops is to do the following on any inputs you dont want autofilled:

<input type='text' readonly onfocus="this.removeAttribute('readonly');" value=''/>

Solution 8 - Html

For Angular users, Since the autocomplete = 'off' ignore by new chrome versions, chrome developer suggests autocomplete= 'false | random-string', so the google chrome/modern browsers have 2 type of users helpers -

> 1. autocomplete='off' (which prevents last cached suggestions). > 2. autocomplete = 'false | random-string' (which prevents autofill setting, since the 'random-string' is not known by the browser).

so what to do, in case of disabling both the annoying suggestions? Here is the trick:-

add autocomplete = 'off' in every input fields. (or simple Jquery).

$("input").attr('autocomplete', 'off');

Remove the <form name='form-name'> tag from HTML code and add ng-form = 'form-name' in your <div> container. adding ng-form="form-name" will also retain all your validations.

Solution 9 - Html

I feel terrible how different browsers use different options in a same functionality.

If it's chrome, use autocomplete="disabled" which handles both autocomplete and address based autofill (two separate things):

element.autocomplete = isGoogleChrome() ? 'disabled' :  'off';

You can get some insight on how to writ isGoogleChrome() from here

https://stackoverflow.com/questions/4565112/javascript-how-to-find-out-if-the-user-browser-is-chrome

Solution 10 - Html

Current working solution using JQuery:

Removed name and id from the input I don't want autofill on and added an identifying class. I then created a hidden input with the field name and id I want. Then on form submit I copy the value from the field with no id and no name (finding it by my identifying class), into the hidden field with the name and id.

HTML

<form id="myform">
    <input class="identifyingclass" value="">
    <input class="hidden" id="city" name="city" value="">
    <button type="submit">Submit</button>
</form>

Javascript

$('#myform').on('submit', function(e) {
     $("#city").val($('.identifyingclass').val());
});

I reckon this should work as I don't see autofill latching on to anything other than an id or name.

Solution 11 - Html

Every answer I could find did not work for me. The most irritating part about my situation was how Android populated the notes field with a login name, resulting in erroneous notes being entered into the database.

I thought about how typing into the text input clears the Android autofill and the below trick worked. Note that simply clearing the value did not remove the autocomplete, I had to set the field's value. Immediately clearing the value after setting a value also did not work. The delay is needed for Android chrome to see a change and remove the filled in value.

Bonus: doing this action on the notes field caused Android to empty the other autocompleted elements in my form.

<script src="/js/jquery-1.12.1.min.js"></script>
<script>
	$(function () {
		$('#notes').val('--');
		setTimeout(
			function(){ $('#notes').val(''); }
			, 2000
		);
	});
</script>
<input type='text' id='notes' name='notes' maxlength='250' size='17'>

The function setTimeout( callback, msec ) is javascript, thus a programmer could implement this without using jQuery.

Solution 12 - Html

I fixed this on my site by replacing the offending input element with

<p class="input" contenteditable="true">&nbsp;</p>

and using jQuery to populate a hidden field prior to submission.

But this is a truly awful hack made necessary by a bad decision at Chromium.

Solution 13 - Html

I usually do this to hide the autofill icon:

<div style="width: 0; overflow:hidden;">
    <input type="text" />
</div>

As Chrome will put the autofill icon on the first writable text field, the icon is placed on the hidden input field.

Note: Making the input field hidden-type or setting its display to 'none' doesn't seem to work.

Solution 14 - Html

autocomplete="off" works in the current Chrome 68 as well as in Chrome 63.

Demo.

Solution 15 - Html

Try to remove the "Id" of the input.

That's how i fixed it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCellydyView Question on Stackoverflow
Solution 1 - HtmlpngView Answer on Stackoverflow
Solution 2 - HtmlErebusView Answer on Stackoverflow
Solution 3 - HtmlbranditoView Answer on Stackoverflow
Solution 4 - HtmlTommyView Answer on Stackoverflow
Solution 5 - HtmlngrnView Answer on Stackoverflow
Solution 6 - Htmluser3486319View Answer on Stackoverflow
Solution 7 - HtmliamwoorView Answer on Stackoverflow
Solution 8 - HtmlKaran VyasView Answer on Stackoverflow
Solution 9 - HtmlSAMUELView Answer on Stackoverflow
Solution 10 - HtmlCellydyView Answer on Stackoverflow
Solution 11 - HtmlKrista KView Answer on Stackoverflow
Solution 12 - HtmllufcView Answer on Stackoverflow
Solution 13 - HtmlJulien OuimetView Answer on Stackoverflow
Solution 14 - HtmlAlexander AbakumovView Answer on Stackoverflow
Solution 15 - HtmlGuillaume RebmannView Answer on Stackoverflow