autocomplete ='off'在Firefox中不起作用?

时间:2017-06-16 11:24:49

标签: javascript html css firefox

我有一个输入字段<input type='text' name='user' autocomplete='off'>,但自动填充仍然有效。

这是我在检查元素时看到的内容

enter image description here

似乎Firefox不知何故认为此字段是密码字段并使用内置Login Manager storage module。我没有在这个输入元素上使用任何Javascript。

我还注意到自动填充下拉列表中有一个奇怪的key符号

enter image description here

如何摆脱该密钥符号并禁用自动完成功能?

继承我的HTML代码

<form class='clearfix'>
  <div id='loginForm'>
    <label>
      Login 
      <span>
      <a href='/memberArea/lostPass.php' id='hackB'>
       Forgot Password? Click here!</a></span>
    </label>
    <input type='text' name='user' id='username' autocomplete="off">
    <label  >Password </label>
    <input type='password' name='pass' id='passLogin' autocomplete="off">
  </div>
  <button class='confirmbutton' id='loginButton'>Login</button>
</form>

1 个答案:

答案 0 :(得分:1)

清除浏览器,试试,

<!--
  <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>
相关问题