Skip to content
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

JavaScriptMessageHandler can not been trigered on Windows Platform #227

Closed
RoleWong opened this issue Mar 16, 2023 · 2 comments
Closed

JavaScriptMessageHandler can not been trigered on Windows Platform #227

RoleWong opened this issue Mar 16, 2023 · 2 comments

Comments

@RoleWong
Copy link

RoleWong commented Mar 16, 2023

I tend to trigger the postMessage with the following codes on HTML.

But those JavaScriptMessageHandlers on Dart can not been triggered.

image

While this problems only occurs on Windows, but not macOS.

Found this PR #168, and I upgrade this package to to desktop_webview_window: ^0.2.0, and the code downloaded do includes the added code from this PR, but this still can not work.

[Update1: ] It seems caused by the following if, that prevent the platfrom aprt from macOS to register the handler. Can I just remove this judgment logic?

image

[Update2: ] Solution found: In this case, postMessage should be called as window.chrome.webview.postMessage(val); , and add a addOnWebMessageReceivedCallback listener on Dart layer. This issue can be cloused.

@RoleWong RoleWong changed the title JavaScriptMessageHandler can not been trigered on Flutter 3.7.7 with Windows 10, built to Windows Platform JavaScriptMessageHandler can not been trigered on Windows Platform Mar 16, 2023
@RoleWong
Copy link
Author

RoleWong commented Mar 16, 2023

** Solution found: In this case, postMessage should be called as window.chrome.webview.postMessage(val); , and add a addOnWebMessageReceivedCallback listener on Dart layer. This issue can be cloused.**

@moodstubos
Copy link

@RoleWong thank you!
This helps a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants