通过HTML或JavaScript禁用Web表单自动填充上? [英] Disable autofill on a web form through HTML or JavaScript?

查看:862
本文介绍了通过HTML或JavaScript禁用Web表单自动填充上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方式,通过HTML或JavaScript禁用在Chrome和表单字段其他浏览器自动填充?我不希望浏览器从浏览器previous用户的形式自动应答填写。

Is there a way to disable autofill in Chrome and other browsers on form fields through HTML or JavaScript? I don't want the browser automatically filling in answers on the forms from previous users of the browser.

我知道我可以清除缓存,但我不能靠反复清除缓存。

I know I can clear the cache, but I can't rely on repeatedly clearing the cache.

推荐答案

您可以在HTML的输入电平加入自动完成=关闭到输入做到这一点。

You can do it at the input level in HTML by adding "autocomplete="off" to the input.

<一个href=\"http://css-tricks.com/snippets/html/autocomplete-off/\">http://css-tricks.com/snippets/html/autocomplete-off/

您也可以通过JS做到这一点,如:

You could also do it via JS such as:

someForm.setAttribute( "autocomplete", "off" ); 
someFormElm.setAttribute( "autocomplete", "off" );

这篇关于通过HTML或JavaScript禁用Web表单自动填充上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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