58

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.

Cellydy
  • 1,245
  • 2
  • 14
  • 24
  • can you provide a fiddle or a url with the issue? – Sebastian Brosch Dec 12 '17 at 19:13
  • I can confirm this also started happening with the release of 63. – brandito Dec 13 '17 at 04:57
  • Can you share a link to see the issue? I tried that yesterday and it worked with `autocomplete="off"` – Sebastian Brosch Dec 13 '17 at 19:02
  • Yes, I think Chrome 63 thing. I'm seeing the same problem, and it's also mentioned here: https://developers.google.com/web/updates/2017/10/chrome-63-deprecations – Erebus Dec 14 '17 at 18:51
  • @Erebus are you talking about the comments or in the actual deprecations? – brandito Dec 14 '17 at 22:45
  • @Brandito sorry, the comment on that page that mentions the problem. I posted a solution below that fixes it for us. – Erebus Dec 15 '17 at 16:50
  • @TyQ. This is a fresh issue. None of those solutions from 2015 work. – Cellydy Dec 22 '17 at 06:50
  • autocomplete="off" is working again now as of Chrome Version 68.0.3440.106 (Official Build) (64-bit) – mothmonsterman Aug 30 '18 at 17:39
  • `autocomplete="nope"` works as of version 69 - per [explanation](https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion): "The trick to really enforcing non-autocompletion is to **assign an invalid value** to the attribute" – Yarin Oct 07 '18 at 23:49
  • Late to the party but by setting `type="search"` with the combination of `autocomplete="off"` seems to work well – CodeJunkie Dec 27 '19 at 20:29

15 Answers15

54

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.

png
  • 944
  • 10
  • 15
  • 1
    This works because it's a new spec telling the browser what type of data is being filled into a given field. If the browser doesn't support autocompleting that type of data, it won't try (and it won't fudge it by looking at the field name and type) Ref: https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164 – James Nisbet Feb 21 '18 at 03:27
  • Thanks @JamesNisbet for that reference. So it works because, as stated in the reference, "In cases where you really want to disable autofill, our suggestion at this point is to utilize the autocomplete attribute to give valid, semantic meaning to your fields. If we encounter an autocomplete attribute that we don't recognize, we won't try and fill it.". Essentially he is saying, to disable autocomplete, still use to the autocomplete attribute, but use a value the browser won't understand. Makes sense, thanks Chrome. – png Feb 22 '18 at 00:13
  • 5
    I've since learned that Autofill is a completely different thing that Chrome won't let you disable at all. Autofill is made up of your data that Chrome stores for you like address information and email addresses. Autocomplete is just a 'helpful' way to re-enter frequently entered information into forms. You can disable the latter but not the former. `autofill !== autocomplete` – James Nisbet Feb 22 '18 at 05:23
  • 1
    What this answer miss is that if you have a form with, let's say, 5 input fields, if you apply `autocomplete="none"` on all fields it doesn't work. If you apply it on just 4 fields it does. It's crazy! Try! –  May 30 '18 at 22:32
  • no longer working. autocomplete="off" is working again now as of Chrome Version 68.0.3440.106 (Official Build) (64-bit) – mothmonsterman Aug 30 '18 at 17:39
  • 1
    Can confirm a behavior change. Seems like autocomplete off is working for inputs whose name attribute does not contain any attribute contained in this list: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill (ie. if your name attribute contains "username" you cannot disable autocomplete, because its autofill). This is a pretty big security risk on public computers. – png Aug 30 '18 at 20:59
  • 1
    While trying to get to the bottom of this, have found some even more confusing behaviour. Not only does Chrome ignore `autocomplete="off"` if the `name` attribute contains the phrase `username` it also does if the `value` attribute contains the phrase `username`. Discovered this while trying to bypass autocomplete on an input that needed to store the phrase `用户名` *(Simplified Chinese for username)*, once saved and reloaded from the database the field auto-filled the field with a username from my saved list. – user692942 Sep 10 '18 at 12:46
  • Anyone able to figure out how Google are bypassing this? You'll never get Chrome input suggestions on the Google search box. – Leonick Sep 17 '18 at 16:41
  • 1
    Just add `autocomplete="no-thanks"` and it works in Chrome Version 70.0.3538.67 – Muleskinner Oct 25 '18 at 11:30
  • Alternative set the `name` property to something complete random. For this to work however, the `label` text also should be something that does not contain text that describe the input field, i.e. cannot contain "phone", "name", "address" etc. – Muleskinner Oct 25 '18 at 11:54
  • 1
    Thanks - Have a client that's trigger happy with autofill and the client inadvertently contaminated the database of their customers when editing details.. Why cant a developer have control over this in future .. we're not all just filling in login details - in some places I need it off (and stay off) to prevent click happy mistakes. – Luke Mar 29 '19 at 00:49
  • A hotfix for labels: `` – user1597430 Aug 21 '19 at 18:12
  • 1
    Why has no-one spoken about how chrome actually decides how to autocomplete a field. It will look at the name, id and label of the field. In a vue app I am building I have managed to disable autocomplete by adding a hidden random string to the label (there is no name or id for this particular input field). This has disabled the autocomplete successfully. – plexus Aug 30 '19 at 00:18
  • 2
    UPDATE 2020: `autocomplete="off"` works for me in Chrome. – Vikram K May 29 '20 at 17:55
  • 1
    UPDATE JUN 2020: `autocomplete="off"` still works for me in Chrome. – aswzen Jun 13 '20 at 16:14
34

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.

Qirel
  • 21,424
  • 7
  • 36
  • 54
Erebus
  • 1,883
  • 2
  • 18
  • 31
17

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

brandito
  • 646
  • 7
  • 19
  • 7
    There is no information about autocomplete="false" in those links. And also it doesn't work. I've tried it on the input AND on the form. – Cellydy Dec 13 '17 at 10:33
  • @Cellydy I posted the wrong second link (and I can't find it anymore) but I've edited my answer to provide more references. – brandito Dec 14 '17 at 22:27
  • @Cellydy yet someone literally posted the same link lol – brandito Dec 14 '17 at 22:41
  • I don't see how it didn't work for you because I recently managed to get our CMS provider to implement autocomplete="false" instead of autocomplete="off" and it's working fine for myself and the sales team. – brandito Dec 15 '17 at 03:06
  • This is the relevant link: https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164 – James Nisbet Feb 21 '18 at 03:26
  • 4
    Don't know what the recent down votes are for, this post is from back when it worked, now it doesn't, not my fault Google can't accept feedback from thousands of developers. – brandito Mar 21 '18 at 01:11
  • If you have time to edit the answer, you have time to fix the answer. – tresf Jan 16 '19 at 17:39
  • @tresf what can be fixed? have you found a way that nobody else here knows about? – brandito Jan 16 '19 at 23:18
  • never mind, it seems after some testing autocomplete="disabled" works again? – brandito Jan 16 '19 at 23:24
  • The solution I used was https://stackoverflow.com/a/47822599/3196753, specifically avoiding any values on WHATWG. I'm using `autocomplete="please-stop"`Although it seems unfair to be downvoted when the answer **was once** correct, it's the community's way of getting it lower on the list so other don't try it which is its duty. Thanks for testing `disabled` against Chrome 72. – tresf Jan 17 '19 at 05:02
  • @tresf at one point nothing worked, which is when I last edited this answer.. we just gave up on trying to disable it as with each new update at the time, it would change. The answer you linked in your comment was also tried numerous times. The reason I was asking why I was being downvoted wasn't because the answer did work at the time, but was actually *removed* all together and *labelled WON'TFIX* by members from the chromium team. There was no 'fix' for this at the time I last edited my answer, the autocomplete was actually being heavily updated during 59-64 (and seems like it still is.) – brandito Jan 17 '19 at 05:09
  • 1
    @tresf it seems they actually did it for a few versions after 64 too: https://bugs.chromium.org/p/chromium/issues/detail?id=587466#c232 – brandito Jan 17 '19 at 05:13
  • 2
    autocomplete="disabled" does not work for me Version 72.0.3626.119 (Official Build) (64-bit) windows 10 – qwertzman Feb 26 '19 at 15:40
  • 3
    Does not seem to be working in my case, Chrome Version 73.0.3683.75 (Official Build) (64-bit), macOS 10.14.3. Frankly, no provided answer, in this entire question, seems to work. I also tested this fix in 72, and numerous other workarounds in this question, and none seemed to work in either version. However, adding `readonly="readonly"` to fields, then removing with JS, after a second or two, works. Definitely do not like this solution, but it's working ‍♂️. – kfriend Mar 14 '19 at 19:09
  • My case might be related to the name of the fields. Browsers seem to ignore autocomplete attribute completely with specific fields names, e.g. a name with "email" in it. – kfriend Mar 14 '19 at 19:31
  • 1
    Does not work again in Chrome 73 – Boris D. Teoharov Apr 22 '19 at 01:24
6

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"

ngrn
  • 138
  • 1
  • 5
5

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 ... />
Tommy
  • 106
  • 1
  • 6
  • 1
    Worked for me! Ty – Matthew Aug 20 '18 at 02:19
  • 1
    You are a genius. I have tried all options and none of them are reliable all the time. This is working and is still working in 2020. I hate it but if it works I don't care. Its the code we need, not the code we deserve! – Craig Howell Oct 30 '20 at 14:08
4

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"

4

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=''/>
iamwoor
  • 43
  • 4
  • Not working for me for autofill but I can see how it would work for autocomplete (may have got them mixed around) so you can keep my +1 – brandito Aug 20 '18 at 02:28
1

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.

Karan Vyas
  • 99
  • 1
  • 4
1

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

JavaScript: How to find out if the user browser is Chrome?

samuelj90
  • 6,484
  • 2
  • 35
  • 38
0

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.

Cellydy
  • 1,245
  • 2
  • 14
  • 24
0

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.

Chris K
  • 19,605
  • 2
  • 29
  • 41
0

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.

lufc
  • 1,826
  • 2
  • 12
  • 18
0

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.

0

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

Demo.

Alexander Abakumov
  • 10,817
  • 10
  • 71
  • 111
-1

Try to remove the "Id" of the input.

That's how i fixed it.