Is there a W3C valid way to disable autocomplete in a HTML form?

后端 未结 18 1140
心在旅途
心在旅途 2020-11-22 05:58

When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML



        
18条回答
  •  被撕碎了的回忆
    2020-11-22 06:18

    I think there's a simpler way. Create a hidden input with a random name (via javascript) and set the username to that. Repeat with the password. This way your backend script knows exactly what the appropriate field name is, while keeping autocomplete in the dark.

    I'm probably wrong, but it's just an idea.

提交回复
热议问题