Reputation: 336
I am working on one chrome extension, which is required to show popup to save password of any particular website.
Please consider the following scenario 1)User opened www.facebook.com in browser. 2)Hit login button. 3)User is logged in. Chrome browser itself gave option "To save password". 4)At this stage I want my plugin to show some custom popup to save password.
Now the question is, how do my plugin come to know that user is logged in to some website. Or how chrome browser comes to know that use is logged in to some website and show popup to save password.
Any help would be highly appreciated.
Thanks
Upvotes: 0
Views: 1172
Reputation: 336
I am able to solve my problem.I am posting my answer,that might be helpful to others also.
So in my case, I want to know that some user has logged in to some website.Here website is not fix, it could be any random website.
So, in order to know, user has clicked "Login" button, i am adding eventListener to window through my content script.
My code is as follows:
window.addEventListener('click', function() {
console.log(this);
});
In the above code you have the element("this") which is clicked.
You can now check id, text,button title of "this" to check if it is "Login" or not.
If its "Login", then user hit the login button.
Upvotes: 2