Chrome prevent autocomplete on input fields

Date: 2021-11-16

Tags: Auto-complete, Auto-fill

Source: https://stackoverflow.com/a/26931180

Sometimes even autocomplete=off won’t prevent filling in credentials into wrong fields.

A workaround is to disable browser autofill using readonly-mode and set writable on focus:

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

The focus event occurs at mouse clicks and tabbing through fields.

55870cookie-checkChrome prevent autocomplete on input fields