I can open my window, and do a lot of things inside of it, for example login via Linkedin or Facebook. But I cannot close it to return to my app.
1/ I tried to catch events to track the url and close the window when the url contains a particular keyword. But the event is never fired. I never have any alert.
var ref = window.open(url, '_blank', 'location=no');
ref.addEventListener('loadstart', function(event)
{
alert(event.url);
});
ref.addEventListener('loadstop', function(event)
{
alert(event.url);
});
2/ So I tried to find a way to check ref.location.url from the first window every n seconds. But ref.location.url doesn't exist. I don't see a way to access the inapp current url from the parent window.
3/ I had the idea to give a name to the inapp window. But the inappbrowser plugin doesn't allow to give a name to the window to open. So the parent window cannot check the url of the child window that way as well.
4/ I tried to ask the child inapp window to close : cordova doesn't want a javascript to close the current window.
self.close(); => cannot
window.close(); => cannot
5/ I tried to revert to cordova.js 2.9.0-0-g83dc4bd , it didn't work as well.
So, I can open a pop up inside my app and use third parties Oauth but then I'm stuck inside this pop up and I have no way to return to my app.
I checked almost everything I could find in the internet and I absolutely don't see how to do now.
I use cordova.js 3.5 Android build , and I install inappbrowser with
cordova plugin add org.apache.cordova.inappbrowser
Everything is standard, cordova.js is correctly loaded, and I can see in the logs InappBrowser is correctly used when I call it.
08-08 16:20:20.594: D/InAppBrowser(8496): target = _blank
Errr... Help?
:)