NSURLProtocol-WebKitSupport
NSURLProtocol-WebKitSupport copied to clipboard
Make your WKWebView happy with NSURLProtocol
我想利用WKWebview支持NSURLProtocol后实现类似页面广告屏蔽的功能. 但是实际运用时发现,一旦调用wk_registerScheme:方法注册监听scheme后,一些POST的表单提交就会出现问题.即使在canInitWithRequest:方法中设置对于POST请求的request不处理也不能解决问题. 用代理跟踪请求时发现,未使用NSURLProtocol进行拦截的POST请求中,HTTPBody里包含了表单post的数据.但是使用了NSURLProtocol后,这些请求发送出去的时候没有携带参数.导致请求结果与预想的出现偏差. 如果您有解决方案或者思路,可否一起讨论一下.谢谢~
请问有什么办法不影响post 的情况下拦截
```swift URLProtocol.wk_register(scheme: "https") URLProtocol.wk_register(scheme: "http") URLProtocol.registerClass(WebPURLProtocol.self) ``` 后post body丢失你是怎么解决的?
crash堆栈日志如下: 0 | WebKit | 0x00000001ea9a9230 WebKit::ChildProcessProxy::sendMessage(std::__1::unique_ptr, WTF::OptionSet) + 24 -- | -- | -- 1 | WebKit | 0x00000001eaaee84c bool WebKit::ChildProcessProxy::send(Messages::LegacyCustomProtocolManager::DidFailWithError&&, unsigned long long, WTF::OptionSet) + 128 2 |...
偶尔会出现崩溃的, Crashlytics崩溃日志如下: 0 | WebKit | WebKit::LegacyCustomProtocolManagerProxy::stopLoading(unsigned long long) + 20 1 | CFNetwork | __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 60 2 | CFNetwork | -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 200 3 | CFNetwork...
这个链接https://h5app-dev.multilotto.com/en/casino/play/chinesenewyearmobile/ (VPN才可以打开) 如果使用这种方式会报错 Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
Note:If you target iOS 11, you can now use WKURLSchemeHandler to avoid this trick! 😆 But, comment said : "A class conforming to the WKURLSchemeHandler protocol provides methods for loading...
最近初学swift做一个Mac应用,用到了wkwebview,但是遇到一个问题,当打开几个页面后再返回到之前的页面,会重新发送网络请求重载页面,网上查了一下,貌似wkwebview不支持缓存,wkwebview的macOS SDK更加不多,所以想知道这个工具能不能解决这个问题。谢谢!