2019, Chrome 76, approach to autocomplete off

后端 未结 9 2214
忘掉有多难
忘掉有多难 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:50

    As of Dec 6, 2019, with Chrome v78.x

    Standard methods like autocomplete="off" are now working almost fine for the latest versions of Chrome. Except for this one:

    This thing is a real bummer because it doesn't only disrespect the standard/non-standard values like "nope" but there's literally no way to turn this off unless the input is not even remotely related with "addressy" terms.

    How on earth we could possibly display address-related input fields without using address-related words? Here comes the easiest solution ever.

    • Make sure the input element's name and id don't include any address-related terms. Attributes like id="input-street" or name="destination-zip" are big no-no.

    • This is the most crucial part: If you are required to use any human-readable address terms for the text input or any of its adjacent elements, insert the "invisible" zero width joiner () between the letters of the said term. In this way, we can fool the AI capability of Chrome and bypass its strict autocompletion behavior.

    Some working examples:

    
    
    

    And there you go. No more pesky menus for managing addresses, nor any regular autocompletion menus.

提交回复
热议问题