如何浏览器知道什么时候提示用户保存密码? [英] How does browser know when to prompt user to save password?

查看:112
本文介绍了如何浏览器知道什么时候提示用户保存密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是关系到我这里问的问题:
<一href=\"http://stackoverflow.com/questions/2382329/how-can-i-get-browser-to-prompt-to-save-password\">How我可以让浏览器提示保存密码?

This is related to the question I asked here: How can I get browser to prompt to save password?

这就是问题所在:我不能让我的浏览器提示我保存我开发该网站的密码。 (我说的是,当你提交的Firefox的形式,有时会出现的吧,上面写着记住yoursite.com密码?是/不是现在/从不)

This is the problem: I CAN'T get my browser to prompt me to save the password for the site I'm developing. (I'm talking about the bar that appears sometimes when you submit a form on Firefox, that says "Remember the password for yoursite.com? Yes / Not now / Never")

这是超级令人沮丧,因为火狐(和其他大多数流行的浏览器,这是我希望的工作以类似的方式)的这个特性似乎是一个谜。这就像一个魔术的浏览器,它看你的code,或者你提交,或什么的,如果它看起来像一个用户名(或电子邮件地址)领域的登录表单和密码字段,它提供了保存。

This is super frustrating because this feature of Firefox (and most other modern browsers, which I hope work in a similar fashion) seems to be a mystery. It's like a magic trick the browser does, where it looks at your code, or what you submit, or something, and if it "looks" like a login form with a username (or email address) field and a password field, it offers to save.

除了在这种情况下,在那里他们用我的登录表单后,不是我提供的用户选项,它使我发疯。 : - )

Except in this case, where it's not offering my users that option after they use my login form, and it's making me nuts. :-)

(我查了一下我的Firefox settings--我没有告诉浏览器从不为该站点。应该提示。)

(I checked my Firefox settings-- I have NOT told the browser "never" for this site. It should be prompting.)

什么是Firefox使用知道什么时候应提示用户保存的启发?这应该不是太难回答了,因为它是正确的,在Mozilla的源代码(我不知道去哪里找,否则我会尽量挖掘出来我自己)。我也没有运气找到一个从Mozilla的开发博客文章或一些其他类似的开发人员注意到这一点。

What are the heuristics that Firefox uses to know when it should prompt the user to save? This shouldn't be too difficult to answer, since it's right there in the Mozilla source (I don't know where to look or else I'd try to dig it out myself). I've also had no luck finding a blog post or some other similar developer note from the Mozilla developers about this.

(我会好这个问题被回答了Safari浏览器或IE浏览器,我会想象所有的浏览器的用户非常类似的规则,所以如果我能得到它在其中的一个工作,它会在别人打工。)

(I would be fine with this question being answered for Safari or IE; I would imagine that all the browsers user very similar rules, so if I can get it working in one of them, it will work in the others.)

(*请注意,如果你的回答对我有什么用饼干,加密或其他任何东西,是关于我如何存储我的本地数据库密码,赔率是强大的,你误解了我的问题。:-)

(* Note that if your answer to me has anything to do with cookies, encryption or anything else that is about how I'm storing passwords in my local database, odds are strong that you have misunderstood my question. :-)

推荐答案

根据关我看过,我觉得火狐由 form.elements [N] .TYPE ==密码的检测密码(通过所有的表单元素迭代),然后通过文本字段表单元素立刻密码字段前向后搜索(更多信息<一检测到用户名字段href=\"http://mxr.mozilla.org/firefox/source/toolkit/components/passwordmgr/src/nsLoginManager.js#626\">here).您可以尝试类似的东西在Javascript中,看看你是否可以检测到您的密码字段。

Based off what I have read, I think Firefox detects passwords by form.elements[n].type == "password" (iterating through all form elements) and then detects the username field by searching backwards through form elements for the text field immediately before the password field (more info here). You might try something similar in Javascript and see if you can detect your password field.

据我所知,你的登录表单需要一个&LT的一部分;形式&GT; 或Firefox将不对其进行检测。设置你的密码字段id =密码可能不能伤害或者。

From what I can tell, your login form needs to be part of a <form> or Firefox won't detect it. Setting id="password" on your password field probably couldn't hurt either.

如果这仍然是给你很多的问题,我会建议在Mozilla项目的开发者邮件列表询问(你甚至可以得到谁设计的功能,开发者的响应)。

If this is still giving you a lot of problems, I would recommend asking on one of the Mozilla project's developer mailing lists (you might even get a response from the developer who designed the feature).

这篇关于如何浏览器知道什么时候提示用户保存密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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