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

目前Demo中无法使用CustomWebview(master分支) #271

Open
thorjay opened this issue Jul 28, 2023 · 0 comments
Open

目前Demo中无法使用CustomWebview(master分支) #271

thorjay opened this issue Jul 28, 2023 · 0 comments

Comments

@thorjay
Copy link

thorjay commented Jul 28, 2023

直接使用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

@thorjay thorjay changed the title 目前上Demo中无法使用CustomWebview(master分支) 目前Demo中无法使用CustomWebview(master分支) Jul 28, 2023
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

1 participant