8

I'm opening a new window to complete an Instagram oauth like so:

var newWindow = window.open(url, 'Instagram Login', 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);

where the url is simply the oauth path for the given app. Upon authentication, the following code looks for a function that was defined on the application side to trigger a success callback:

if (window.opener && window.opener.foo) {
    window.opener.foo("photo:social:login:success", gon.social_profile);
}

This works flawlessly on desktop as well as ios, but android chrome tells me window.opener is null, meaning the callback is never reached.

The strange part is that trying the exact same flow on an incognito window in android chrome it works without any issue. window.opener points to the original window, and the callback function is successfully fired.

I've already attempted using parent.window.opener as well as top.window.opener as the code which opens the popup window is inside of an iframe, but it seems to make no difference. is there any reason why android would act differently here?

Pabs123
  • 3,385
  • 13
  • 29
  • in my case, the problem was a way I tested. After several redirects, I had been ending on localhost in popup, so I was manually changing 'localhost' to my laptop IP. It was ok for testing IE inside virtualbox, but didn't work for mobile. I mean it is possible to lost opener somewhere on the way. – ada Sep 10 '18 at 13:12

0 Answers0