Skip to content

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

@thorjay

Description

@thorjay

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions