android - InAppBrowser not closing? -
i'm using inappbrowser plugin (v1.1.1) cordova oauth login process. unfortunately, inappbrowser doesn't appear closing browser. "closebrowser" function instead continually triggers interval, , browser remains on-screen on android (i have not tried other devices @ time.)
is there way forcibly close inappbrowser other .close()
, or hide it? or maybe there's flaw in code somewhere locking browser.
loginpage.prototype.handleexternallogin = function (externallogin) { var _this = this; var ref = window.open(environment_1.settings.baseurl + externallogin.route.url, "_blank", "location=no"); ref.addeventlistener('loadstart', function (event) { if (_.startswith(event.url, environment_1.settings.baseurl + "/api/account/account/externallogincallback")) { // want load different url give mobile access token console.log('get external-mobile-token'); _this.closebrowser(ref); var ref2 = window.open(environment_1.settings.baseurl + "/api/account/external-mobile-token", "_blank" /*, "location=no"*/); ref2.addeventlistener('loadstop', function (event) { console.log('loadstop ' + event.url); if (event.url == environment_1.settings.baseurl + "/api/account/external-mobile-token") { ref2.executescript({ code: 'window.document.documentelement.innertext' }, function (contents) { _this.login(contents); _this.closebrowser(ref2); }); } }); ref2.addeventlistener('loaderror', function (event) { console.log(event); _this.closebrowser(ref2); // todo - something? }); } }); ref.addeventlistener('loaderror', function (event) { console.log(event); _this.closebrowser(ref); // todo - something? }); }; loginpage.prototype.closebrowser = function (browser) { var interval = setinterval(function () { console.log('closing'); browser.close(); }, 10); browser.addeventlistener('exit', function () { console.log('closed'); clearinterval(interval); }); }; loginpage.prototype.login = function (token) { console.log(token); };
the above code generated typescript, figured wouldn't confuse issue.
it appears closing inappbrowser
, opening @ same time causing issue; rewriting process need 1 window solved issue.
Comments
Post a Comment