How to track and block ajax requests in WKWebView?

From my understanding and testing of any code, we can only track page navigation requests using

func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { if // some condition { decisionHandler(.allow) // to allow the page navigation. } else { decisionHandler(.cancel) // to cancel the page navigation. } } 

But is there a way to track and block some ajax requests in WKWebView?

And also to capture ajax response.

+5
source share

Source: https://habr.com/ru/post/1269693/


All Articles