在我的AngularJS-App中,我想打开一个新的Popup并在其上附加一个EventListener。以下是angular-oauth1-client的相应部分:
var auth_window = window.open(authorizeEndpoint + "?oauth_token=" + oauth_token + "&oauth_callback=" + callback_url, '_blank', 'location=yes,clearcache=yes,hidden=yes');
auth_window.addEventListener('loadstart', function(event) {
console.log('hi');
if((event.url).startsWith(callback_url)) {
if(angular.isFunction(beforeWindowClose)){
beforeWindowClose();
}
auth_window.close();
deffered.resolve({
returned_oauth_token: getURLParameter(event.url, 'oauth_token'),
oauth_verifier: getURLParameter(event.url, 'verifier'),
wp_scope: getURLParameter(event.url, 'wp_scope')
});
}
});
打开所需的窗口,但看起来EventListener不起作用,因为我在重新加载时没有得到console.log。
有人可以帮帮我吗?