如何在 Web 表单字段/输入标签上禁用浏览器自动完成功能? [英] How do you disable browser autocomplete on web form field / input tags?

查看:35
本文介绍了如何在 Web 表单字段/输入标签上禁用浏览器自动完成功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何在主要浏览器中禁用特定输入(或表单域)的自动完成功能?

How do you disable autocomplete in the major browsers for a specific input (or form field)?

推荐答案

Chrome 的解决方案是将 autocomplete="new-password" 添加到输入类型密码中.请检查下面的示例.

The solution for Chrome is to add autocomplete="new-password" to the input type password. Please check the example below.

示例:

<form name="myForm"" method="post">
   <input name="user" type="text" />
   <input name="pass" type="password" autocomplete="new-password" />
   <input type="submit">
</form>

如果 Chrome 找到一个 type password 框,它总是会自动完成数据,足以指示该框 autocomplete = "new-password".

Chrome always autocomplete the data if it finds a box of type password, just enough to indicate for that box autocomplete = "new-password".

这对我很有效.

注意:使用 F12 确保您的更改生效.很多时候,浏览器将页面保存在缓存中,这给了我一个不好的印象,它不起作用,但实际上浏览器并没有带来变化.

Note: make sure with F12 that your changes take effect. Many times, browsers save the page in the cache, and this gave me a bad impression that it did not work, but the browser did not actually bring the changes.

这篇关于如何在 Web 表单字段/输入标签上禁用浏览器自动完成功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆