autocomplete="off"为啥不生效呢
时间: 2023-08-21 11:03:54 浏览: 276
js 开发之autocomplete=”off”在chrom中失效的解决办法
5星 · 资源好评率100%
autocomplete="off"不生效的原因是因为浏览器内部也会默认开启一个输入字段后自动补全的功能。即使将autocomplete值设为off,在某些情况下仍会失效。为了解决这个问题,可以将该属性赋一个除on或off之外的任意值,例如autocomplete="new-pwd"。这样可以绕过浏览器的默认设置,确保autocomplete属性生效。\[1\]另外,还有一种方法是在input框中设置autocomplete="new-password",虽然官方只有"on"和"off"两个值,但是"new-password"在一些网站上也被使用,并且经过测试是有效的。\[2\]总之,为了确保autocomplete="off"生效,可以尝试使用这些方法来绕过浏览器的默认设置。\[3\]
#### 引用[.reference_title]
- *1* [autocomplete="off" 不生效的解决方法](https://blog.csdn.net/MrLiber/article/details/83214232)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [autocomplete=“off“‘不起作用解决方案](https://blog.csdn.net/baidu_39812199/article/details/112218582)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* ['autocomplete="off"'在Chrome中不起作用解决方案](https://blog.csdn.net/weixin_34520360/article/details/117840063)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文