我有一个包含用户名和密码字段的管理表单,Chrome会记住该表单,因为它会记住用户名和密码。我想防止这些字段自动填充。我做了很多搜索,已经尝试过自动完成标记(以输入和形式),displany:样式标记中没有和对无效自动完成的javascript调用...而这些都不起作用。
你能帮我一下吗?
谢谢!
链接到要点https://gist.github.com/runspired/b9fdf1fa74fc9fb4554418dea35718fe
<!--
<form autocomplete="off"> will turn off autocomplete for the form in most browsers
except for username/email/password fields
-->
<form autocomplete="off">
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields -->
<input id="username" style="display:none" type="text" name="fakeusernameremembered">
<input id="password" style="display:none" type="password" name="fakepasswordremembered">
<!--
<input autocomplete="nope"> turns off autocomplete on many other browsers that don't respect
the form's "off", but not for "password" inputs.
-->
<input id="real-username" type="text" autocomplete="nope">
<!--
<input type="password" autocomplete="new-password" will turn it off for passwords everywhere
-->
<input id="real-password" type="password" autocomplete="new-password">
</form>
Run Code Online (Sandbox Code Playgroud)
cra*_*231 -3
在 HTML 5 中,您可以通过以下两种方式之一来完成此操作...
<form action="demo_form.asp" autocomplete="off">
Run Code Online (Sandbox Code Playgroud)
或者单独控制
<input type="email" name="email" autocomplete="off">
Run Code Online (Sandbox Code Playgroud)
欲了解更多信息 - http://www.w3schools.com/html/html5_form_attributes.asp
归档时间: |
|
查看次数: |
8697 次 |
最近记录: |