如何避免在Chrome表单中自动填充用户名/密码?

4 html forms google-chrome

我有一个包含用户名和密码字段的管理表单,Chrome会记住该表单,因为它会记住用户名和密码。我想防止这些字段自动填充。我做了很多搜索,已经尝试过自动完成标记(以输入和形式),displany:样式标记中没有和对无效自动完成的javascript调用...而这些都不起作用。

你能帮我一下吗?

谢谢!

Fiv*_*ell 7

链接到要点https://gist.github.com/runspired/b9fdf1fa74fc9fb4554418dea35718fe

<!--
  <form autocomplete="off"> will turn off autocomplete for the form in most browsers
  except for username/email/password fields
  -->
<form autocomplete="off">

  <!--  fake fields are a workaround for chrome/opera autofill getting the wrong fields -->
  <input id="username" style="display:none" type="text" name="fakeusernameremembered">
  <input id="password" style="display:none" type="password" name="fakepasswordremembered">

  <!--
    <input autocomplete="nope"> turns off autocomplete on many other browsers that don't respect
    the form's "off", but not for "password" inputs.
  -->
  <input id="real-username" type="text" autocomplete="nope">

  <!--
    <input type="password" autocomplete="new-password" will turn it off for passwords everywhere
    -->
  <input id="real-password" type="password" autocomplete="new-password">

</form>
Run Code Online (Sandbox Code Playgroud)

  • 太好了,现在我们正在针对 Google Chrome 设置蜜罐……这个世界出了点问题 (3认同)

cra*_*231 -3

在 HTML 5 中,您可以通过以下两种方式之一来完成此操作...

<form action="demo_form.asp" autocomplete="off">
Run Code Online (Sandbox Code Playgroud)

或者单独控制

<input type="email" name="email" autocomplete="off">
Run Code Online (Sandbox Code Playgroud)

欲了解更多信息 - http://www.w3schools.com/html/html5_form_attributes.asp

  • 我不明白这些赞成票,因为 OP 明确表示他已经尝试过这一点,但没有取得任何成功,并且对比 w3schools 更可靠的来源进行的一些研究表明,这些属性确实对 chrome 没有影响。 (3认同)