如何检测浏览器何时保存密码? [英] How to detect when browser places saved password?

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

问题描述

我正在尝试检测浏览器何时将已保存的用户名和密码放入输入字段。我看了这篇文章,但我无法选择更改此功能,其他解决方案也无效。

I'm trying to detect when a browser places a saved username and password into the input fields. I've looked at this post , but I don't have the option to change this functionality, and the other solutions on don't work.

基本上,我有如果加载时字段为空,则禁用登录按钮。但是当浏览器填写输入时,它不会启用该按钮。我正试图找到它是如何变化的。

Basically, I have a disabled login button if the fields are empty on load. But when a browser fills in the input, it doesn't enable the button. I'm trying to find how to see if it changes.

我正在使用jQuery和JS。

I'm using jQuery and JS.

我尝试过.change,on .ready,on .load等等。它似乎发生在.load事件之后。

I've tried .change, on .ready, on .load, and all. It seems to happen after the .load event.

有没有人知道这个的解决方案?我想避免使用任何类型的超时。

Does anyone know a solution to this? I would like to avoid using any sort of timeout.

推荐答案

我认为没有办法检测浏览器是否有一些构建-in预先填充字段的功能。

I think there is no way to detect if the browser has some buil-in feature that pre-populates the fields.

你可以通过启用按钮的计时器解决问题,如果有的话。
这样的事情:

You could solve the problem with the a timer that enable the button, if something is there. Something like this:

setInterval(function (){
 if($("#username").val()!=""){
  $("#loginbutton").attr("enabled","enabled"); 
 }
},1000)

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

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