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

原生WKWebview如何使用KKJSBridge实现资源拦截 #58

Closed
chenzufeng opened this issue Jan 7, 2021 · 4 comments
Closed

原生WKWebview如何使用KKJSBridge实现资源拦截 #58

chenzufeng opened this issue Jan 7, 2021 · 4 comments

Comments

@chenzufeng
Copy link

chenzufeng commented Jan 7, 2021

项目计划使用WKWebview,想拦截请求做离线加载。但拦截后遇到请求body丢失问题。
1、请教下原生WKWebview如何最小代价使用KKJSBridge实现拦截?
2、项目已使用Cordova和H5做通信,会和kkjsbridge冲突吗?
ps:
总的述求就是不使用kkjsbridge通信能力,也不关心cookie问题,仅仅做请求拦截并加载本地资源。

@karosLi
Copy link
Owner

karosLi commented Jan 8, 2021

1、KKJSBridge 的请求拦截能力就是基于 KKJSBridge 通信能力,是不能拆分的
2、你们项目已使用 Cordova 和 H5 做通信,这个你可以看做是 H5 通过 JS API 去调用原生的能力。这个跟 KKJSBridge 不冲突
3、WKWebview 最小化拦截,demo 里已经体现了,你可以看看

@chenzufeng
Copy link
Author

好的,谢谢

@chenzufeng
Copy link
Author

再问下,KKJSBridge/AjaxHook是不是不支持资源拦截?
demo中改为KKJSBridge/AjaxHook后,HtmlURLProtocol就拦不到静态资源了。
KKJSBridge/AjaxProtocolHook是可以的。

@chenzufeng chenzufeng reopened this Jan 8, 2021
@karosLi
Copy link
Owner

karosLi commented Jan 12, 2021

都支持的。只不过 KKJSBridge/AjaxHook 需要自己去注册 http 协议才行,demo 里没有表示出来,现在补充了。
image

@karosLi karosLi closed this as completed Jan 13, 2021
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

2 participants