Disable input autofill

Disable input autofill

  • When writing a Form form style, it is troublesome or even impossible to modify the input style after autofill, and there are some scenarios that do not need autofill.

  • The typebrowser namematches according to the and of the form control when saving the data.

  • The commonly used ones are typefor password, namefor emal, username, password, telephoneetc., even if not set name.

  • The browser will match the previously saved form space when the form is loaded, and then automatically fill it with the information saved on the client side. Additional data may be filled into adjacent form controls.

  • Autofill can be turned off by setting autocompleteto .off

  • input autocompleteindicates whether the value of this control can be automatically filled by the browser, setting offit to means that the user must manually fill in the value, or the page provides its own auto-completion method. Browsers do not autofill this field. .

  • However, the browser still displays the autofill hint (option box) when the form control gets focus.

  • And in the actual situation type, passwordeven if the form control for is set autocomplete="off", it can't effectively prohibit automatic filling (most of them don't work).

  • Fortunately autocompletesetting to new-passwordsuccessfully disables this, which represents a new password (such as used when creating an account or changing a password).

  • The reference is 163 mailbox:

  • And its compatibility is also good:

Program Summary

  • If you want to disable the autofill function of the form control, you can autocomplete="new-password"add . If there are more than one in a form type="password", you only need to set this attribute to one of them (no matter which one) to disable them all.

  • Setting can new-passwordalso prevent the browser from popping up autofill prompts, including type="password"controls other than .

Guess you like

Origin blog.csdn.net/Andrew_Chenwq/article/details/127237282