【问题标题】:Disabling Chrome 84 form autofill禁用 Chrome 84 表单自动填充
【发布时间】:2020-11-28 01:21:42
【问题描述】:

我正在尝试从我的一个表单字段中禁用 Chrome 版本 84 自动填充,并且我有很多方法似乎都不起作用:

我试过这些:

<!-- setting autocomplete to random value other than on or off -->
<input autocomplete="xyz" type="text"/>

<!-- setting autocomplete to random value other than on or off in form and input -->
<form autocomplete="xyz">
<input autocomplete="xyz" type="text"/>
</form>

<!-- setting autocomplete to chrome-off -->
<input autocomplete="chrome-off" type="text"/>

我也尝试过创建隐藏元素来“欺骗”Chrome,但我没能做到。 我已经完成了这些帖子中提到的所有方法:

Autocomplete off vs false?

Chrome ignores autocomplete="off"

我没有选择,我错过了什么吗?

【问题讨论】:

  • 是登录表单吗?大多数浏览器都不再支持关闭它
  • 不,它是我导航栏中的简单搜索框,我已经尝试设置 type=" search" 似乎不起作用

标签: javascript html google-chrome


【解决方案1】:

我找到了一个似乎与建议相反的解决方案,尽管我不知道每个人是否都会这样:

<!-- simply set the type to search and then set autocomplete to off -->
<input type="search" autocomplete="off"/>

如果您希望删除 x 以及输入字段,您可以这样做:

input[type=search]::-ms-clear {  display: none; width : 0; height: 0; }
input[type=search]::-ms-reveal {  display: none; width : 0; height: 0; }

/* clears the 'X' from Chrome */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }

资源:https://blog.maximerouiller.com/post/remove-the-x-from-internet-explorer-and-chrome-input-type-search/

【讨论】:

    猜你喜欢
    • 2013-03-22
    • 1970-01-01
    • 2019-02-17
    • 2019-04-10
    相关资源
    最近更新 更多