autocomplete ='off'无法在firefox上运行

Dee*_*dhy 18 html browser firefox

我正面临一个浏览器问题:

我创建了2个相同域的登录页面.

  1. www.example.com/login.cfm
  2. www.example.com/newLogin.cfm

我在两个页面中为两个表单添加了不同的表单名称.此外,我还autocomplete = 'off'为第二个表单和该表单中的文本字段添加了.(但它是第一个表单).

现在,如果我www.testDomain.com/login.cfm在浏览器中登录时保存用户名和密码,那么即使自动完成关闭,用户名列表也会自动填充在第二个登录页面的用户名字段中.出于安全原因,我需要阻止它.有没有办法做到这一点?我正在使用FireFox V21.

小智 36

$("#CVV").on("focusout", function() {
    if ($(this).val() == "") {  
      $(this).attr("type", "text");
    }   
});
Run Code Online (Sandbox Code Playgroud)
<input type="text" name="username" class="input" ID="CVV" onfocus="removeErr('CVV'); $(this).attr('type', 'password');">
Run Code Online (Sandbox Code Playgroud)

  • 密码的自动完成仍未禁用 (4认同)
  • 是的,这正是我为解决这个问题所做的.谢谢. (3认同)
  • 我到处寻找FF解决方案.这最终成功了.谢谢. (2认同)

Bob*_*tor 32

这是我发现阻止Firefox自动完成的最干净的解决方案.

 <!-- The text and password here are to prevent FF from auto filling my login credentials because it ignores autocomplete="off"-->
 <input type="text" style="display:none">
 <input type="password" style="display:none">
Run Code Online (Sandbox Code Playgroud)

将此代码片段添加到您输入的密码类型上方.

据我所知,Firefox正在寻找类型为Password的输入,并填写密码,然后将用户名添加到其上方类型文本的输入中.没有名称或ID,输入不会添加到帖子中,但这仍然是一个黑客.

  • 这对我很有用,我不敢相信这是2015年8月,这种hacky方法是必要的,常见的HTML标准解决了这个问题. (3认同)
  • 我真不敢相信 这很疯狂,但截至2017年6月24日,它仍然有效。我已经测试了其他解决方案,但密码仍是自动完成的,但现在已解决。 (2认同)

Pul*_*Fox 8

你们都应该试试这个属性:

<input type="password" autocomplete="new-password" />

请参阅那里的文档:https : //developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#Preventing_autofilling_with_autocompletenew-password


Aru*_*til -4

将autocomplete="off"添加到表单标签,如 Mozilla 文档中所述

检查以下链接以获取更多信息

如何关闭自动完成功能

  • 我的表单标签、输入标签、保存输入的 div 中都有 autocomplete="off" ,这太疯狂了,当我双击该字段时它会显示建议,火狐到底是什么? (4认同)