Open minarja1 opened 1 month ago
@minarja1 Thanks for your feedback! JsBridge will be cleared when the page is fully loaded, so it will be useless to inject it early.
@KevinnZou Thank you for the reply. Can you please explain in a bit more detail? Why would it be cleared after the page is loaded?
@KevinnZou Thank you for the reply. Can you please explain in a bit more detail? Why would it be cleared after the page is loaded?
It's the system behavior
Hi @KevinnZou,
I am trying to use the js bridge to establish communication between native and webview. The implementation works on iOS but not on Android. The problem seems to be in the sequence of operations.
The website loads and expects the js bridge to provide it with authorisation tokens. However, the js bridge is only injected after the url is finished loading. What is the reason behind the decision to inject the bridge after the page is fully loaded as seen in the snippet of
WebView.kt
:My implementation follows the docs with nothing special about it.
This is my logcat output:
You can see there are only a couple of milliseconds between the reported injection of the bridge and chromium trying to use it and reporting it is as unavailable.
Thanks in advance for your reply and this library!