我正在制作一个Chrome扩展程序,需要显示弹出窗口以保存任何特定网站的密码。
请考虑以下情况 1)用户在浏览器中打开www.facebook.com。 2)点击登录按钮。 3)用户已登录。Chrome浏览器本身提供选项"保存密码"。 4)在这个阶段,我希望我的插件显示一些自定义弹出窗口来保存密码。
现在的问题是,我的插件如何知道用户已登录某个网站。 或者Chrome浏览器如何知道某些网站已登录使用并显示弹出窗口以保存密码。
任何帮助都将受到高度赞赏。
由于
答案 0 :(得分:1)
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.