2019, Chrome 76, approach to autocomplete off

后端 未结 9 2179
忘掉有多难
忘掉有多难 2020-12-29 04:43

There are are few posts out there about this. You spend hours going through each answer, testing, reading comments, to find that there is no solution. What have you done in

9条回答
  •  春和景丽
    2020-12-29 04:59

    * This answer is incorrect. I've published a better (but uglier) solution as a new answer and kept this answer since some parts may still be useful. If that's not how to deal with incorrect answers on stackoverflow, feel free to delete this one *

    Consider using autocomplete=, where is unique per field and across page loads.

    For example, if a field is the N-th field created after the page was requested at timestamp TS, its can be chosen to be nope__.

    Effect on autocomplete: since is a custom value for autocomplete, chromium does not activate the autocomplete function (see form_structure.cc).

    Effect on autofill: chromium recognizes a field by comparing its fingerprint with those of earlier encountered fields (see form_field_data.cc). If recognized it may offer a list of remembered values. The fingerprints contain the value of the autocomplete attribute. Since no two nonces are equal, no field is recognized.

    Notes:

    • The terms autocomplete and autofill as used here are swapped compared to gasman's reply.

    • All fields should be created dynamically on the client-side (unless you are willing to not have the page cached).

提交回复
热议问题