我听说现在所有的网络浏览器都忽略 autocomplete="off"
属性,因为它防止用户更改密码使其易于记住(从而被破解)。
但是对于我的情况,我只想针对更改密码表单禁用自动完成功能,而不是登录表单。我该怎么做?
以下是我(简化后的)代码:
<!DOCTYPE html>
<html>
<body>
<form action="?page=change_pass" method="POST">
<input type="password" name="oldPass" placeholder="Current password">
<input type="password" id="p1" name="newPass" placeholder="New password">
<input type="password" id="p2" placeholder="Confirm new password">
<button type="submit">Change password</button>
</form>
<script>
//This script checks if p1 == p2
</script>
</body>
</html>