Webview App Integration

Use the Javascript-Widget within a web-view in your mobile app.

You can also integrate our Javascript-Widget solution inside a web-view in your mobile App(s).

The integration follows almost the same procedure as described in our description for Javascript-Widget.

Implementation Steps for the Hosted Page Implementing the JS-Widget

You will need a HTML page that implements the JS-Widget, just like described in Javascript-Widget. In addition, the following changes are recommended:

HTML

<!-- in the <head> -->
<!-- Scale settings so the page does not zoom/move-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no, maximum-scale=1.0, user-scalable=no">

CSS

#XS2A-Form input:not([type='checkbox']):not([type='radio']), #XS2A-Form select {
    /* Increase the font size for input elements, 16px minimum is recommended */
    font-size: 16px !important;
}

JS-to-Native Callbacks

The most important steps to be taken are about handling the callbacks the JS-Widget does in your mobile app. For example, when the user finishes the process, you probably want to close the web-view and show the user a specific screen. The same needs to be done when the user aborts.

This can be accomplished with registering callbacks, that notify the host app (your app) from within the Javascript on the hosted page. You might already have callbacks defined such as xs2a.finish() or xs2a.abort() , for which you will need to add some more functionality:

Implementation Steps for the Native Apps

In the app, we need some functionality to show the web-view and to deal with the callbacks defined above.

iOS

The following is an example class showing an integration with WKWebView and how the JS-to-Native callbacks are defined and configured:

You can present this web-view like this:

Android

Register the JS-to-Native callbacks:

Configure and present the web-view:

Last updated

Was this helpful?