I am working on a Google Chrome extension. We need to display a pop-up login window for users to enter credentials, then handle logins. My extension project consists of three pages: extension, background and options. Options html and JavaScript pieces handle login, however reference to a window opened from options.html is always null
.
Therefore, I tried sending a message from options to background scripts, and have the background script open the login window. That part is working, however I never receive any events from that popup, and therefore cannot process the results of login.
case 'openSignInWindow':
let loginWindowRef = window.open('https://myurl.com/client/signin.html', 'signinpopup', 'width=400,height=400,resizeable,scrollbars');
console.log('login window ref:', loginWindowRef);
loginWindowRef.onload = () => { alert("message one "); };
loginWindowRef.addEventListener('DOMAttrModified', event => {
console.log('event:', event);
});
break;
Tried onsubmit
- the one that I am interested in, as well as other events. My ultimate goal is to catch the "DOM Mutation events."
What am I doing wrong?