我怎样才能避免在报名表的浏览器prepopulating领域? [英] How can I avoid browser prepopulating fields in my registration form?

查看:279
本文介绍了我怎样才能避免在报名表的浏览器prepopulating领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自动完成=关闭不是我追求的。基本上,我的登记表上有田手机和密码放在另一个上方。 (见截图)

autocomplete="off" is not what I am after. Basically, on my registration form there are fields "phone" and "password" placed one above the other. (see screenshot)

电话字段被,烦人,prepopulated用一个用户名,我猜是什么浏览器做的 - 浏览器发现输入密码的字段,并假定文本输入字段之前它是一个用户名字段。效果是这样的:

The "phone" field gets, annoyingly, prepopulated with a username, as I guess what the browser is doing - the browser finds a field of type password and assumes the text input field just before it is a username field. The effect is this:

为什么我没有兴趣在手机领域的非标autocomplete属性,是,我希望用户能够容易地填补这一形式可能,如果他们已经previously上输入自己的手机号码其他网站(进入所谓的手机字段),他们可以受益于这种显示出来,因为他们开始输入到字段中。这就是为什么我不希望完全关闭自动完成了。

Why I am not interested in the non-standard autocomplete attribute for the phone field, is that I do want user to be able to fill this form as easily as possible and if they have previously entered their phone number on other sites (into fields called "phone") they could benefit from this showing up as they start typing into the field. That's why I don't want to turn autocomplete off altogether.

我想多在重组领域以某种方式避免这种行为的方向。或者,告诉上面的密码字段的字段有什么用它做浏览器的一些方法,或密码字段不用于认证目的。不知怎的,它标记为这一点。或注入一些无形的元素插图中这两个领域?

I was thinking more in the direction of reorganizing the fields somehow to avoid this behaviour. Or some way of telling the browser that the field above the password field has nothing to do with it, or that the password field is not used for authentication purposes. Somehow mark it as that. Or inject some invisible element inbetween these two fields?

任何想法?

标记中:

<input id="phone" name="phone" type="text" value="" maxlength="30">
<input id="newPassword" name="newPassword" type="password" value="" maxlength="20">

我得到在Chrome,FF,这种行为(不知道IE浏览器,得到了这样一个古老的版本,我的机器上,甚至不想要开始担心IE呢。)

I am getting this behaviour on Chrome, FF, (not sure about IE, got an archaic version of that on my machine, don't even want to start worrying about IE yet.)

推荐答案

密码管理器将搜索第一个密码字段,和最近的文本字段之前。

Password managers will search the first password field, and the closest text field before it.

因此​​,所有你需要做的就是添加隐形文字和密码字段。(显示:无)上面的新密码

So all you have to do is add invisible text and password fields (display:none) above "new password".

火狐<一个href=\"http://mxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/nsLoginManager.js#667\">tries国米$ P $ 3篇密码字段为更改密码的动作,所以,如果你不想,你应该是安全的,并增加另一个看不见的密码字段。

Firefox tries to interpret 3 password fields as a "change password" action, so if you don't want that you should be safe adding yet another invisible password field.

这篇关于我怎样才能避免在报名表的浏览器prepopulating领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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