Answer the question
In order to leave comments, you need to log in
How to communicate with the native environment through WebView?
For example, a page from www.example.com/myapp.html is loaded. There is nothing on this page except the included js file (built react application) with 1 method. How can you call a method from the Native among this method and get a response from it?
Answer the question
In order to leave comments, you need to log in
you need to use JavaScript custom method. Create html and function like
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script type="text/javascript">
function sendMessage(bucketCount){
alert(bucketCount);
}
</script>
</head>
<body>
</body>
</html>
this.webview && this.webview.injectJavaScript("sendMessage(5);");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question