I have content script based Chrome extension. I initiate the sign in process through a popup window in the content script.
I open a popup window using the below code and then wait till its closed.
However, I get an 'undefined' from window.open
method. Does anybody know why this happens?
loginwin
is undefined
in below code although the popup window opens up fine with the specified login_url
. The code below is called from my content script.
var loginWin = window.open(login_url, 'LoginWindow', "width=655,height=490");
console.log(loginWin);
// Check every 100 ms if the popup is closed.
var finishedInterval = setInterval(function() {
console.log('checking if loginWin closed');
if (loginWin.closed) {
clearInterval(finishedInterval);
console.log('popup is now closed');
Backbone.history.navigate('index', true);
}
}, 1000);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…