Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

New Developer
Posts: 4
Registered: ‎01-09-2013
My Device: 10 Alpha B
My Carrier: no provider
Accepted Solution

BB10 - interaction with a childwindow

Hello everyone,


I have a problem with interacting with a child window.

I developed an app with phonegap (2.7.0) and I'm trying to realise a paypal payment within my app.

This require to open a child window to display the Paypal login and after verification paypal redirect me to whatever I want.


My problem is that I have no ways to know when the transaction is complete and when to close the window.
Ideally, I would like to read the url inside the childwindow to act accordingly but once I've opened my window, i can't do anything in it.


Here is my call:


childwindow = window.open('https://www.sandbox.paypal.com/webscr?cmd=_express-checkout-mobile&token='+token, '_blank');


 My childwindow object contains handlers for loadstart, loadstop and exit.


I'm suspecting that the inAppBrowser from phonegap is just useless and prevent me from using the proper webworks childbrowser.


Has anyone had this problem before ?


Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: BB10 - interaction with a childwindow

Hi there,


Check out this sample here:



PayPal will likely have a URL that it redirects to / some token that gets appended to that URL. You can monitor via setInterval to see what the URL of the childWindow currently is and, once it matches what you're waiting for (i.e. the success page), you can close the childWindow programmatically.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Developer
Posts: 4
Registered: ‎01-09-2013
My Device: 10 Alpha B
My Carrier: no provider

Re: BB10 - interaction with a childwindow

Hi Erik, Thanks for your answer.


I finally solved my problem: the new phonegap feature inAppBrowser.

Since cordova 2.3.0, they introduced a childBrowser based on one of the previous plugins. Problem is, if it work pretty well on Android and iOS, they didn't spent any time at all on Blackberry I'd say. Their instance override the webworks one, but  on this one, you can't execute any code in the child window, therefore no way to know the currently location.


I stripped down that inAppBrowser in the cordova code to fallback on the webworks one on blackberry and everything's fine now: finally access to the location.href and use a setInterval to close the window after redirection as suggested by Erik.


Hope this will help people with that issue too.

New Developer
Posts: 4
Registered: ‎10-07-2013
My Device: Bold5
My Carrier: MTN

Re: BB10 - interaction with a childwindow

Hi, can you provide a code sample of how you were able to solve this problem?


I have tried every method that I know, it'snot working in Webworks 2.2