Masking input characters without type=password

前端 未结 6 950
-上瘾入骨i
-上瘾入骨i 2020-12-30 22:30

So I have a problem with newer browsers saving passwords. Say I have a password box like so:


         


        
6条回答
  •  长发绾君心
    2020-12-30 23:11

    We had a use case where admins could view other user records and make changes. One of the fields was that other user's password. In this instance, letting the password manager pre-fill the field was a "bad thing". So what we ended up doing was waiting a short period of time after the page had loaded and then cleared out the password field...

    // After the page has loaded...
    window.addEventListener('load', setTimeout(function() {
      // Wait a bit and then clear out the contents of the field
      document.getElementById('other-password').value='';
    }), 100);
    

提交回复
热议问题