我已经听说现在所有的Web浏览器都忽略了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>
谢谢您的帮助。
尝试:
<!DOCTYPE html>
<html>
<body>
<form action="?page=change_pass" method="POST" autocomplete="off">
<input type="password" name="oldPass" placeholder="Current password" autocomplete="off">
<input type="password" id="p1" name="newPass" placeholder="New password" autocomplete="off">
<input type="password" id="p2" placeholder="Confirm new password" autocomplete="off">
<button type="submit">Change password</button>
</form>
<script>
//This script checks if p1 == p2
</script>
</body>
</html>