Secure Modal
Overview
Some 3rd party JavaScript libraries such as the Apple Pay JS API require a secure iOS WKWebView window with external scripting blocked. GoNative's Secure Modal Plugin can be used to allow the functionality provided by these libraries to work within your app.

Implementation Guide
Once the premium module has been added to your app, you may use the following GoNative JavaScript Bridge commands to access its functionality.
First, define a gonative_modal_closed()
function on the page from where the modal window is opened, for example:
function gonative_modal_closed(data) {
if (data.status) {
alert('modal closed with status param: ' + data.status);
}
else{
alert('modal closed');
}
}
↔️GoNative JavaScript Bridge
To launch the modal window, use the command:
gonative.modal.launch({ 'url': 'https://applepaydemo.apple.com', 'autoClosePath':'/payment-complete' });
When the URL /payment-complete?status=success
is opened in the modal the modal will close automatically and the callback function gonative_modal_closed({"status":"success"})
will be called on the opening page. If no URL parameters are provided then gonative_modal_closed()
is called without arguments.
Updated 7 months ago