How do I disable the save password bubble in chrome using Javascript?

前端 未结 13 1934
不思量自难忘°
不思量自难忘° 2020-11-27 19:56

I need to be able to prevent the Save Password bubble from even showing up after a user logs in.

Autocomplete=off is not the answer.

I have not come across a

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 20:29

    After hours of searching, I came up with my own solution, which seems to work in Chrome and Safari (though not in Firefox or Opera, and I haven't tested IE). The trick is to surround the password field with two dummy fields.

    
    
    
    

    Here's the CSS I used:

    .stealthy {
      left: 0;
      margin: 0;
      max-height: 1px;
      max-width: 1px;
      opacity: 0;
      outline: none;
      overflow: hidden;
      pointer-events: none;
      position: absolute;
      top: 0;
      z-index: -1;
    }
    

    Note: The dummy input fields can no longer be hidden with display: none as many have suggested, because browsers detect that and ignore the hidden fields, even if the fields themselves are not hidden but are enclosed in a hidden wrapper. Hence, the reason for the CSS class which essentially makes input fields invisible and unclickable without "hiding" them.

提交回复
热议问题