如何禁用Chrome自动填充用户名/电子邮件密码? [英] How to disable Chrome to autofill username/email password?
问题描述
我知道它已经在SO上得到了很多次的回复,但是对于老版本的Chrome来说也是如此。
我有Chrome版本53.0.2785.143。
我想禁用Chrome自动填充密码字段,
我已经尝试了所有旧的答案中提到的方法,
方法1:使用伪造的用户名密码试用
$ b p> < input style =display:nonetype =textname =fakeusernameremembered/>
< input style =display:nonetype =passwordname =fakepasswordremembered/>
方法2:使用 $ b code> autocomplete ='new-password'和 autocomplete ='false'
和 autocomplete ='off'
但它们都不起作用。
试试这个 display:none
< input type =textname =prevent_autofillid =prevent_autofillvalue =style =display:none; />
< input type =passwordname =password_fakeid =password_fakevalue =style =display:none; />
< input type =passwordname =passwordid =passwordvalue =/>
您也可以使用 jQuery
来解决这个问题问题,希望这会对你有帮助,如果不是请在这里发表评论,祝你好运:)
更新:
这取决于chrome版本,有时这对于chrome新版本不起作用,所以您应该尝试很多事情来防止此问题,请尝试使用这些代码片段,并且请将评论发生了什么:)
解决方案2
var input = this;
(name);
var id = $(input).attr('id');
$(input).removeAttr(' name');
$(input).removeAttr('id');
setTimeout(function(){
$(input).attr('name',name );
$(input).attr('id',id);
},1);
});
它从元素中删除name和id属性,并在1ms后将它们分配回去。准备好文档。
解决方案3
< input type =textname =email>
< input type =passwordname =passwordautocomplete =new-password>
经过测试并可在Chrome 53中使用
解决方案4
尝试 autocomplete =false
而不是 autocomplete =off
或 nofill
I know its been answered many times on SO but that os for older versions of Chrome.
I have Chrome Version 53.0.2785.143.
I want to disable Chrome to autofill password fields,
I have tried all methods mentioned in older SO answers,
Method 1:
Tried using fake username passwords.
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
Method 2:
Tried using autocomplete='new-password'
and autocomplete='false'
and autocomplete='off'
But none of it works.
Try this display:none
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" />
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" />
<input type="password" name="password" id="password" value="" />
You can also use jQuery
to solve this problem,hope this will be helped to you,if not please put a comment here,good luck :)
Update:
This is depend on chrome version,sometimes this will be not work for chrome new versions,so you should have try many things to prevent this problem,try these code snippets also and please put a comment what happened :)
Solution 2
$('form[autocomplete="off"] input, input[autocomplete="off"]').each(function () {
var input = this;
var name = $(input).attr('name');
var id = $(input).attr('id');
$(input).removeAttr('name');
$(input).removeAttr('id');
setTimeout(function () {
$(input).attr('name', name);
$(input).attr('id', id);
}, 1);
});
It removes "name" and "id" attributes from elements and assigns them back after 1ms. Put this in document get ready.
Solution 3
<input type="text" name="email">
<input type="password" name="password" autocomplete="new-password">
Tested and works in Chrome 53
Solution 4
try autocomplete="false"
instead of autocomplete="off"
or nofill
这篇关于如何禁用Chrome自动填充用户名/电子邮件密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!