This method allows you to redirect your users out from the mobile application to a specified app or webpage. For example, a WhatsApp button in your page that redirects your users to WhatsApp app from your mobile application. Or, a URL embedded in your page that redirects your users to a browser from your mobile application.
Here’s an example
<script>
jQuery(function($){
//Redirect to WhatsApp
$("#my_button").on("click", function(){
var web_data = [{
"type": "external",
"data": "whatsapp://send?text=abc",
}];
window.top.ReactNativeWebView?.postMessage(JSON.stringify(web_data));
});
//Redirect to specific webpage
$("#my_button").on("click", function(){
var web_data = [{
"type": "external",
"data": "https://google.com",
}];
window.top.ReactNativeWebView?.postMessage(JSON.stringify(web_data));
});
});
</script>