title: How can i intercept XHR calls from WKWebview?
body: <p>How can i intercept XHR calls from WKWebview? </p>
  
  <p>The following works only for the Webview URL but not XHR calls made by the site hosted in the WKWebView.</p>
  
  <pre><code>[Export("webView:decidePolicyForNavigationAction:decisionHandler:")]
          public override void DecidePolicy(WKWebView webView, WKNavigationAction navigationAction, Action&lt;WKNavigationActionPolicy&gt; decisionHandler)
          {
              if (Reference == null || !Reference.TryGetTarget(out FormsWebViewRenderer renderer)) return;
              if (renderer.Element == null) return;
  
              var response = renderer.Element.HandleNavigationStartRequest(navigationAction.Request.Url.ToString());
  
              if (response.Cancel || response.OffloadOntoDevice)
              {
                  if (response.OffloadOntoDevice)
                      AttemptOpenCustomUrlScheme(navigationAction.Request.Url);
  
                  decisionHandler(WKNavigationActionPolicy.Cancel);
              }
  
              else
              {
                  decisionHandler(WKNavigationActionPolicy.Allow);
                  renderer.Element.Navigating = true;
              }
          }
  </code></pre>
  
  <p>I found that WKURLSchemeHandler may help but i don't understand how to use it.</p>
  
  <p>Can someone please help with that?</p>