当输入类型为密码时,autocomplete ='off' 不起作用,并在其上方设置输入字段以启用自动完成 [英] autocomplete ='off' is not working when the input type is password and make the input field above it to enable autocomplete
问题描述
我有一个禁用了自动完成功能的表单,但它不起作用,并且可以在 Firefox 和更高版本的 chrome 中启用自动完成
I have an form with autocomplete disabled but it does not works and makes the autocomplete to be enabled in firefox and higher version of chrome
<form method="post" autocomplete="off" action="">
<ul class="field-set">
<li>
<label>Username:</label>
<input type="text" name="acct" id="username" maxlength="100" size="20">
</li>
<li>
<label>Password:</label>
<input type="password" name="pswd" id="password" maxlength="16" size="20" >
</li>
<li>
<input type="submit" class="button" value="Login" id="Login" name="Login">
</li>
</ul>
</form>
当类型从密码更改为文本时,它适用于所有浏览器.谁能帮忙解决这个问题?
When the type is changed from password to text it works in all browser. Can anyone help to solve this issue?
推荐答案
浏览器通常有两个相关但不同的表单功能:
Browser's normally have two related yet different features regarding forms:
表单自动完成,其中
<input type="text">
类型(和类似)的项目收集键入的值并以下拉的形式提供回向下列表.
(这是一个简单的功能,效果很好.)
Form auto-complete, where items of
<input type="text">
type (and similar) collect typed values and offer them back in the form of a drop-down list.
(It's a simple feature that works pretty well.)
密码管理器,当浏览器检测到您已提交登录表单时,它会提示您记住用户名/密码组合.返回站点时,大多数浏览器会在下拉框中显示可用的用户名(Firefox、Chrome、Internet Explorer...),但有些浏览器有工具栏按钮 (Opera).此外,Chrome 以硬编码黄色突出显示字段.
(这取决于启发式方法,可能会在某些页面上失败.)
Password manager, where browser prompts to remember username/password combinations when it detects you've submitted a login form. When returning to the site, most browsers display available usernames in a drop-down box (Firefox, Chrome, Internet Explorer...) but some have a toolbar button (Opera). Also, Chrome highlights the fields in hard-coded yellow.
(This depends on heuristics and might fail on certain pages.)
存在标记为 autocomplete="off"
的表单的边缘情况.如果它是一个登录表单并且用户之前已经存储了用户名/密码,会发生什么?实际上删除本地数据库中的密码看起来不合适,所以可能没有浏览器这样做.(事实上,表单自动完成中的数据也不会被删除.)Firefox 决定赋予用户权力:你有密码,所以我会让你使用它.Chrome 决定授权该网站.
There's an edge case with forms tagged as autocomplete="off"
. What happens if it's a login form and the user has previously stored a username/password? Actually removing the password from the local database looks like inappropriate so probably no browser does so. (In fact, data from form auto-complete is not erased either.) Firefox decides to give power to the user: you have a password, so I'll let you use it. Chrome decides to give power to the site.
这篇关于当输入类型为密码时,autocomplete ='off' 不起作用,并在其上方设置输入字段以启用自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!