-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
直接使用Demo,替换成CustomWebview,js和java互调都会碰到一些问题
原因:
- java调用js,会手动处理jscommand,loadurl时会报错"Uncaught SyntaxError: Invalid or unexpected token"
- js调用java,目前BridgeWebiew是采用@JavascriptInterface来注册函数,但BridgeHelper还未同步;CustomWebview,现在像是通过shouldOverrideUrlLoading()拦截,再结合registerHandler()等方法来实现的,这部分可能是需要去手动注册,所以直接使用Demo不可行。
解决:
将目前BridgeWebview中的代码功能同步到BridgeHelper中,同时将原生Java的回调函数放入公共接口WebViewJavascriptBridge中,可以解决目前功能实现不同步的问题,同时直接将CustomWebview替换BridgeWebviewdemo,demo代码也能运行成功;
-PR
解决CustomWebview当前demo无法使用的问题 #270
Metadata
Metadata
Assignees
Labels
No labels