Google Chrome版本76.0.3809.100(官方内部版本)(64位)自动完成行为 [英] Google Chrome Version 76.0.3809.100 (Official Build) (64-bit) Autocomplete Behaviour

查看:462
本文介绍了Google Chrome版本76.0.3809.100(官方内部版本)(64位)自动完成行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在所有浏览器中禁用google chrome的永久自动完成功能,以实现用户体验(我的Chrome版本为76). 我尝试了许多解决方案,包括:

I want to disable google chrome's persistent autocomplete in all browser for user experience (my Chrome version is 76). I have tried many solution including :

1).来自的答案 Chrome会忽略autocomplete ="off"

1). The answers from Chrome ignores autocomplete="off"

2).来自的所有答案 autocomplete ='off当输入类型为密码并在其上方的输入字段启用自动填充功能时,'不起作用

2). All the answers from autocomplete ='off' is not working when the input type is password and make the input field above it to enable autocomplete

其中

1). Autocomplete ="off",autocomplete ="somerandomstring"

1). Autocomplete="off", autocomplete="somerandomstring"

2).在其上方用隐藏样式创建另一个假输入

2). create another fake input above it with hidden style

3).用不可见的div包裹

3). wrap it with invisible div

似乎两个链接的答案都是针对Google chrome过时版本的解决方案,该版本很可能早于76 chrome版本.

It seems that the answers from both links are the solution for the outdated version of google chrome almost likely older than 76 chrome version.

<input name="number" type="text" class="form-control search" placeholder="No. Invoice" >
//this input is getting filled with persistent google chrome autocomplete

预期的输出:未填充自动填充

Expected Output : not filled with autocomplete

实际输出:已填充

提前谢谢!

推荐答案

我刚遇到同样的问题,但原始答案似乎都无效.

I just came across this same issue and none of the original answers seem to work.

当我使用占位符文本时,我想出了一种解决方案:如果值是空白,则将占位符文本添加为​​值,然后更改颜色,然后使用onfocus事件删除等于的值占位符并删除颜色.

As i use the placeholder text, I came up with a solution of adding the placeholder text as the value if the value is blank, as well as changing the color and then use the onfocus event to remove the value if it's equal to the placeholder and remove the color.

这里是一个例子:

<input type="text" class="form-control" id="search" placeholder="Search Users" value='Search Users' style="color: #6c757d;" onfocus="if (this.value == this.placeholder) {this.value=''; this.style.color=null;}">

您仍然需要注意的事情:

The things that you would still have to look out for:

  • 您需要将此添加到每个输入中.
  • 您需要在验证时检查输入是否等于占位符.

我发现还有另一种解决方案:

There is one other solution that i found worked:

为空输入添加一个值,然后使用超时将其删除,这应该在自动完成功能运行后发生.

Add a value to empty input and then remove it using a timeout, this should happen after the autocomplete has run.

html:

<input type="text" class="form-control NoAutoComplete" id="search" placeholder="Search Users" value='Search Users'>

CSS:

.NoAutoComplete {
  color: #6c757d;
}

JS:

setTimeout(function () {
    $(".NoAutoComplete").val("");
    $(".NoAutoComplete").removeClass( "NoAutoComplete" );
}, 1000);

我对此并没有做太多的研究,但是您应该能够将一个类添加到所有不需要值的输入中,然后同时删除所有值和类.

i haven't done to much looking in to this, but you should be able to add a class to all inputs that need not have a value and then delete all values and class at the same time.

这篇关于Google Chrome版本76.0.3809.100(官方内部版本)(64位)自动完成行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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