priyadarshini puja
priyadarshini puja

Reputation: 139

Autocomplete off in HTML5

I have tried both autocomplete="off" and autocomplete="false" in HTML5 form but It's not working in chrome version (73.0.3683.103).

Upvotes: 3

Views: 4989

Answers (1)

Julian Camilleri
Julian Camilleri

Reputation: 3095

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...

This formation is going to prevent Chrome and Firefox to offer autofill and autocomplete for all input fields inside the form. (as discussed here)

Although it is known that some browsers ignore this; there's a full discussion in the link attached to this thread of possible fixes.

Now works for me in Chrome 72.0.3626.121 having never worked previously.

I had been using <input type="text" id="something" pattern="[ \S]+" role="presentation" autocomplete="nope"> but that now doesn't work.

You can read more about autocomplete on MDN.

You can also opt to use some sort of library if relevant.

There doesn't seem to be one working solution from the investigation above though.

Read more about this on stackoverflow.

Upvotes: 4

Related Questions