首页 > 解决方案 > 无法在 chrome 上禁用自动完成功能

问题描述

我需要避免 chrome 用存储在浏览器上的登录数据填充某些字段,我尝试添加autocomplete="off"autocomplete="unknown-autocomplete-value"但 chrome 它仍然填充这些字段,没有使用 javascript 的任何其他方式?

标签: htmlgoogle-chromeautocomplete

解决方案


你可以发布你的代码,因为在我的情况下它的工作。通过运行代码片段比较名字姓氏

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="form.php" target="_blank" method="post">
        <label>First Name </label><input type="text" name="FirstName" autocomplete="off"><br><br>
        <label>Last Name </label><input type="text" name="LastName"><br><br>
        <label>Password </label><input type="password" name="password"><br><br>
        <label>Male </label><input type="radio" name="gender"><br>
        <label>Female </label><input type="radio" name="gender"><br>
        <label>Others </label><input type="radio" name="gender"><br>
        <label for=""></label>
        <input type="submit" value="Submit">
    </form>
</body>
</html>


推荐阅读