16
Views
3
Comments
InAppBrowser Mobile App not terminating
Question
Application Type
Mobile
Service Studio Version
11.10.3 (Build 36648)

Hi Community,

I have mobile application that needs to post to a vendors URL with headers. Once the vendors website is displayed the user will enter data and then press a submit button. On pressing the submit button the vendors website posts a callback to an exposed REST API within the solution.

I am utilising the Cordova InAppBroswer plugin to successful display the posted URL and receive the callback on the exposed REST API.

I have listed the code that I am using inside a JavaScript widget;

var pageContent = '<html><head></head><body><form id="submitForm" action="' + $parameters.Url + '" method="post">' +

'<input type="hidden" name="DataValue1" value="' + $parameters.DataValue1 + '">' +

'<input type="hidden" name="DataValue2" value="' + $parameters.DataValue2 + '">' +

'<input type="hidden" name="CallBackURL" value="' + $parameters.CallbackURL + '">' +

'</form> <script type="text/javascript">document.getElementById("submitForm").submit();</script></body></html>';

var pageContentUrl = 'data:text/html;base64,' + btoa(pageContent);

var browserRef = window.cordova.InAppBrowser.open(pageContentUrl , "_blank", "hidden=no,location=no,clearsessioncache=yes,clearcache=yes,zoom=no");

The issue that I am facing, is that once the callback has been received by the exposed REST API, the vendors website is no longer visible but a blank screen is displayed instead which I can only assumed is that the InAppBroswer is still open.

My question is how can I close the InAppBroswer and return to the main app screen once I’ve received the callback from the vendors website?

Rank: #299

Dear DK0121,
Good Day

I understand your concern that you want to come back to your application again once you open & receive vendor data in InAppBrowser.

Similar satiation we are handling in one of our bank where we have our logic on vendor website. From that vendor website, we are using callback url after their logic ends. Its deeplink call back URI which we have provided them.
So after logic finishes from their side, they are calling our deeplink and it is closing inapp browser and redirect us to desired screen.

The other option is provided in this thread you can have a look.
https://www.outsystems.com/forums/discussion/60693/how-to-close-the-iab-and-return-to-the-app/

Hope this helps you with your concern.

Thanks & Regards,

Rank: #2760

Hi DK0121,

You can use the InAppBrowserEvents Application from the Forge to handle events from the browser.

Then use the OnLoadStart Event on IAB to catch the loading URL (evt_url parameter) , and check if it is the URL of the expected callback.

If it is, just call the Close Client Action,

which will trigger the OnExit Event. There you can handle your redirections based on whatever business logic you have and make your users navigate to a specific screen.

I Hope this helps.

Regards.