以编程方式禁用Firefox中的密码确认弹出窗口

时间:2015-05-06 00:06:35

标签: html firefox passwords

我有一个简单的密码更改表单,如下所示。它是较大页面的一部分,但这个片段用于说明。此表单中没有用户标识符 - 没有登录名,ID或其他引用。这不是必需的,因为该信息作为会话数据的一部分存储在服务器上,并在通过AJAX调用提交此表单时在那里获取。

<div id="passwordChange" >
    <form id="passwordForm">
        <table class="formbox dropshadow">
            <thead>
            <tr>
                <td colspan="2">Change Password</td>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td><label for="currentPassword">Current Password</label></td>
                <td><input id="currentPassword" name="oldPassword" type="password" required pattern=".{5,20}" title="Passwords should be between 5 and 20 characters long"></td>
            </tr>
            <tr>
                <td><label for="newPassword">New Password</label></td>
                <td><input id="newPassword" name="newPassword" type="password" required pattern=".{5,20}" title="Passwords should be between 5 and 20 characters long"></td>
            </tr>
            <tr>
                <td><label for="confirmPassword">Confirm Password</label></td>
                <td><input id="confirmPassword" name="confirmPassword" type="password" required pattern=".{5,20}" title="Passwords should be between 5 and 20 characters long"></td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <td colspan=2>
                    <input type="hidden" name="cmd" value="setPassword">
                    <input type=submit name=submit value="Change Password">
                    <input type=button name=cancel value="Cancel">
                </td>
            </tr>

            </tfoot>
        </table>
    </form>
</div>

如果我在第一个密码框中输入Firefox已为域存储的密码,并且Firefox已为多个存储用户存储了该密码,则单击Change Password时会弹出此框:

enter image description here

问题是,我可能不会更改任何列出的用户的密码,但如果不给Firefox一个答案我就无法继续这一点。这使得无法更改密码未由Firefox密码管理器存储的用户的密码。

现在,可能有一个配置选项来启用或禁用此行为(我很高兴听到它)但这只对我的计算机有用。

我希望能够将此行为作为页面的一部分禁用,以便我的客户不会遇到它。

我可以使用一些HTML标记或属性吗?是否存在Javascript hack,或者只是对可以阻止这种情况的表单进行结构更改?

FWIW我正在运行Firefox 37.0.2

2 个答案:

答案 0 :(得分:2)

在解决了一段时间之后,我尝试将autocomplete="off"属性添加到我的表单中。使用此<input>,请注意,密码管理器不会受到干扰:

<input autocomplete="off" id="currentPassword" name="oldPassword" type="password" required pattern=".{5,20}" title="Passwords should be between 5 and 20 characters long">

现在,面对Daniel A. White提到的错误报告(见上文)以及this等网页上的注释,两者都表明能够关闭{{} 1}}正在从浏览器中删除。也许是这样,但似乎它并没有应用 here ,这是我所关注的。

(关于浏览器制造商是否应该单方面凌驾于网站设计者意愿的另一个论点是另一个地方和时间的辩论。)

脚注:虽然摆弄这个我做了一些本来应该是显而易见的事情,但并不直观:我点击红色autocomplete并关闭了窗口。密码管理器消失了,没有更新任何东西,一切都按我的意愿。我仍然觉得“以上都没有”&#39;按钮,或者现在不是&#39;或者其他任何更友好的东西。

答案 1 :(得分:1)

没有HTML标记或属性可以实现这一点。 这是特定于浏览器的,而不是网页操作。