title: WkWebView does not load links to pdfs
body: <p>The WKWebView is not loading links. I am linking users to a privacy policy page, and the page has a group of links. The links are all pdfs hosted by wix. On safari and Chrome it works, but not on WKWebView. When the page loads, and you click the links, I just get an error: </p>
  
  <pre><code>Unknown result for URL 0x28157d110 (https)
  </code></pre>
  
  <p>This is how I'm loading the web view...</p>
  
  <pre><code>webView.load(URLRequest(url: URL(string: "https://mywebsite.io/legal")!))
  </code></pre>
  
  <p>EDIT: This is <a href="https://stackoverflow.com/questions/34547161/downloading-files-wkwebview-ios">different from other questions</a> because I have no intention of downloading the pdf - I just want to display it the same way that Safari does.</p>
  
  <p>EDIT: I just replaced WKWebView with UIWebView (deprecated) and the pdfs load. The issue is with WKWebView. The Pdfs are ssl-enabled https -></p>
  
  <pre><code>let req = URLRequest(url: URL(string: "https://mywebsite.io/legal")!)
      legacyWebView.loadRequest(req)
  </code></pre>
  
  <p>EDIT: There is a page here <a href="https://stackoverflow.com/questions/47754252/how-to-open-a-link-to-a-pdf-with-wkwebview">How to open a Link to a PDF with wkwebview</a> that suggests that you must know the link URL before opening the pdf, I don't think this is true though. </p>
  
  <p>EDIT: I have 2 delegate methods implemented, including the one suggested below by @Kiril. Links to pdfs still do not open.</p>
  
  <pre><code>func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {
          decisionHandler(WKNavigationActionPolicy.allow)
      }
      func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -&gt; Void) {
          decisionHandler(WKNavigationResponsePolicy.allow)
      }
  </code></pre>