-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some problem with javascriptHanlder #64
Comments
Yeah I know! I fixed this problem in the last commit 👍 .. I need to update the documentation because there is a little change on how it works! Later I'm going to publish the new version |
Feature added now on the new version 1.1.0. <script>
// you need to wait and listen the JavaScript event flutterInAppBrowserPlatformReady
window.addEventListener("flutterInAppBrowserPlatformReady", function(event) {
console.log("ready");
// then you can call the window.flutter_inappbrowser.callHandler() method.
// callHandler() returns a Promise that you can use to get data from Dart side.
window.flutter_inappbrowser.callHandler('handlerFoo').then(function(result) {
console.log(result, typeof result);
console.log(JSON.stringify(result), result.bar);
});
window.flutter_inappbrowser.callHandler('handlerFooWithArgs', 1, true, ['bar', 5], {foo: 'baz'}).then(function(result) {
console.log(result, typeof result);
console.log(JSON.stringify(result));
});
});
</script> Instead, on the // Inject JavaScript that will receive data back from Flutter
webView.injectScriptCode("""
window.flutter_inappbrowser.callHandler('test', 'Text from Javascript').then(function(result) {
console.log(result);
});
"""); |
I have tested in some diff version SDK android emulator,I find some devices do not have callHandler function in window.flutter_inappbrowser object,.so I guess there has compatible problem on it. |
Which version?? Thanks |
I find the _callHandler function is exist, |
Ok! I will try that! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
My window.flutter_inappbrowser object have a method named _callHandler but not callHandler
and I call this method, _callHandler in my JS code, but the InAppWebViewController can not recive the call
My js code:
My dart code
see th picture
The text was updated successfully, but these errors were encountered: