Question

I want to get signal of it. Because I am creating face recognition add-on (like master password) for firefox.

edit: when user add username I need to check user face. If only the given username and his saved face are equal, then only password should put in to password field. What I want is when user add his username execute my application to recognize face. I want to get signal of after adding username.

Was it helpful?

Solution

The basic naive solution is to add an event listener on all text input elements and listen for any event that suits your needs, particularly interesting in your case should be focus, blur, or maybe input events. There's also the element.onchange property that might get handy.

Typical usage (simplified logic):

var inputs = document.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
    inputs[i].onchange = yourFunctionToCall;
}

Some additional notes:

  1. It might be a good idea to add listeners only on pages that have a stored password.
  2. It might be a good idea to add listeners only on pages that contain at least one <input type="password" /> element.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top