1.Native->H5使用runJavaScript接口注入JS进行通信,H5->Native使用registerJavaScriptProy接口,事先将Native方法注册至H5侧,H5通过调用前端方法实现与Native侧的通信。2.使用onInterceptrequest接口拦截H5侧请求,同时将Native侧数据作为Response返回至H5,实现Native与H5的通信。参考链接:runJavaScript、onInterceptRequest
1.Native->H5使用runJavaScript接口注入JS进行通信,H5->Native使用
registerJavaScriptProy
接口,事先将Native方法注册至H5侧,H5通过调用前端方法实现与Native侧的通信。2.使用
onInterceptrequest
接口拦截H5侧请求,同时将Native侧数据作为Response返回至H5,实现Native与H5的通信。参考链接:
runJavaScript、onInterceptRequest