This is a migrated thread and some comments may be shown as answers.

ChildBrower how to close

7 Answers 37 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 30 Jun 2013, 05:28 PM
I'm using the ChildBrowser to login to an external web page to authenticate the user. How do I automatically close the browser when the authentication is done? I was thinking of trying this but it doesn't work as the onLocationChange doesn't seem to fire when the browser is open, or at least I couldn't get it working. Cheers , Chris.

window.plugins.childBrowser.onLocationChange = function (url) {
                  if (url == _successurl)
                      {
                         window.plugins.childBrowser.close();
                      }
}
                  }

7 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 01 Jul 2013, 08:24 AM
Another thing I have just thought is the locationchnage was done with a server redirect - does it have to be a user initiated location change i.e. from a button press? I'm not by a computer right now so I can't test.
0
Yavor Georgiev
Telerik team
answered on 01 Jul 2013, 10:14 AM
Hi Chris,

 The folks at Cordova have come up with a built-in API that supersedes the ChildBrowser plugin. In fact, ChildBrowser is no longer under active development.

 I'd suggest checking out the InAppBrowser API, which is introduced in Cordova 2.4. It has more granular URL loading events which might be able to do what you need.

Regards,
Yavor Georgiev
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0
Chris
Top achievements
Rank 1
answered on 01 Jul 2013, 10:24 AM
How do I add the InAppBrowser to Icenium. Can I just call it from JS in Icenium straight away or do I need to configure Icenium.

I was wondering what this means

<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser" />
0
Yavor Georgiev
Telerik team
answered on 01 Jul 2013, 10:30 AM
Hello Chris,

 InAppBrowser is built into Cordova itself. You don't have to do anything in order to be able to call it.

Regards,
Yavor Georgiev
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0
Chris
Top achievements
Rank 1
answered on 01 Jul 2013, 10:37 AM
Also if were to open the browser in the Cordova webview

var ref = window.open(encodeURI('http://mydomain.com/login.aspx'), '_self', 'location=yes');
 
In the code on my server is it as simple as putting some js in the page from my server to redirect back.

window.open('home.html', '_self');
0
Yavor Georgiev
Telerik team
answered on 01 Jul 2013, 10:53 AM
Hello Chris,

 I'm afraid it's not that simple - calling window.open from within the InAppBrowser won't close the popup. What you need to do is handle the loadstop event of the InAppBrowser object that window.open returns, watch for a specific url like http://mydomain.com/loginDone.aspx and then close the InAppBrowser.

Regards,
Yavor Georgiev
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0
Chris
Top achievements
Rank 1
answered on 01 Jul 2013, 11:00 AM
That seems straight forward I'll give it a try tonight
Tags
General Discussion
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Yavor Georgiev
Telerik team
Share this question
or