Reputation: 107
I am opening a popup window to make oAuth now i want to catch the final output of the child window to the function from where its been populated.
$scope.login__linkedin=function() {
var child_window=$window.open('http://localhost/oAuthTest/lrvl/public/login','Authentication', 'width=500,height=500');
child_window.onload = function() {
setTimeout(function(){ console.log(child_window.document.documentElement.outerHTML) }, 2000);
//i want my child window value somewhere here.
}
};
i am not getting my final success response code (i am getting nothing actually) in console. I want to make login via linkedin and success in opening the window and getting the user authenticated,but the success response if showing me on my child window i want to get this response on my parent window.
Upvotes: 1
Views: 687
Reputation: 1787
Try to replace $window
with window
What the following gives?
(function() {
var child_window=window.open('http://localhost/oAuthTest/lrvl/public/login','Authentication', 'width=500,height=500');
child_window.onload = function() {
setTimeout(function(){ alert(child_window.document.documentElement.outerHTML); }, 2000);
}
})();
Upvotes: 1
Reputation: 23838
Open your child window
var child_window=$window.open('http://localhost/oAuthTest/lrvl/public/login','Authentication', 'width=500,height=500');
(I'm sure this is from the same domain)
Add a function for the popup window to execute. This function can transfer some data from Popup to Caller through arguments.
child_window.selectUser = function(userId) {
console.log(userId);
//Do whatever you like with this authenticated user
}
Now your popup window has selectUser
function which it can call after authenticating the user.
Upvotes: 1