【问题标题】:Chrome Autofill wrong fields when saved password保存密码时 Chrome 自动填充错误的字段
【发布时间】:2019-10-12 00:39:42
【问题描述】:

我的网站上有 2 个表格。 如果我保存了邮箱和密码等表格有输入密码, 它将在最后一个输入框(type=text)上自动填充电子邮件

我尝试添加 autocomplete=off autocomplete=contact_no name=contact_no 但它不起作用。

    <form>
      login form
      <br>
      <label> email<input type="text" /> </label>
      <label> password <input type="password"/> </label>

      <button type="submit"> submit</button>
    </form>

    <form>
      member update form
      <br>
      <label> readonly email <input type="text"readonly value="abc@google.com"/> </label>
      <label> contact_no <input type="text" name="contact_no" autocomplete="off"/> </label>
      <label> password <input type="password" name="password"/> </label>
      <button type="submit"> submit</button>
    </form>

CodePen

https://upload.cc/i1/2019/05/26/jbBSxa.gif

https://upload.cc/i1/2019/05/26/lQmksB.png

【问题讨论】:

    标签: javascript jquery html google-chrome autocomplete


    【解决方案1】:

    https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

    在大多数现代浏览器中,将自动完成设置为“关闭”不会阻止密码管理器 > 询问用户是否要保存用户名和密码信息,或者 > 自动在站点的登录表单中填写这些值。

    为了帮助 chrome 更好地理解表单输入,您可以尝试使用 autocomplete="tel" 代替联系人号码

    【讨论】:

      猜你喜欢
      • 2016-03-12
      • 2016-03-30
      • 2014-12-11
      • 2023-01-10
      • 2013-06-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-28
      • 2021-09-07
      相关资源
      最近更新 更多