The browser automatically fill in your username and password

In web development over species, have put more browser when we log in, asking whether we want to remember user name and password. When we in the actual development process, will meet some of the demand,

However, there will be

This time only need to put a line in the input of the problem can be solved automatically populated

autocomplete="new-password"

 This is also the reference method Netease mailbox

 

As for why do it? I do not dare to ask, we can not tell ah. Do not! Easy to use on the line.

 However, some UI framework is not supported

 

In such a way that the page will complain, as the error message Well, different, I'm just iviewui as a chestnut.

Although it is written, and when type = "password", it seems no use. But do not party, there is always a way, it is the Black & Technology. Catches mice is a good cat meow.

$(":password").attr("autocomplete", "new-password");
Of course, with a native JS also possible

document.querySelectorAll('input[type=password]').forEach(item=>{
                item.setAttribute("autocomplete","new-password");
})

Guess you like

Origin www.cnblogs.com/ruose/p/11275830.html