1
votes

I have an url to a pdf that doesn't show the pdf extension like:

https://www.myserver.com/lsdhfasjkdhfo2387407402374

The url can be opened in safari but doesn't in my WKWebView

I implemented the WKNavigationDelegate and receive a callback on func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) which I allow. But then nothing happens.

Any idea?

2

2 Answers

0
votes

If you are directly trying to open the pdf from URL into WKWebView it will not work because of restriction added to WKWebView for device protection.

You can refer this article How to open a Link to a PDF with wkwebview for more information.

-1
votes

For previewing pdf file in WKWebView you have to upload pdf on sever and open its link on webview.