PDF file to be downloaded is not displayed when button is pressed in WKWebView in iO13

PDF file to be downloaded is not displayed when button is pressed in WKWebView in iO13


Displayed with no problem on iOS12 or lower in WKWebView

When the download target is a text file

It is displayed normally on iOS13.


Source load location

------------------------------------------------------------------------------

The following methods are executed when the button is pressed.

func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)

guard let url = navigationAction.request.url else {

decisionHandler(.cancel)

return

}

switch navigationAction.navigationType {

case .formSubmitted:

webView.load(URLRequest(url: url))

decisionHandler(.cancel)

return

}

decisionHandler(.allow)

}

}

------------------------------------------------------------------------------



ErrorMessage

The following error message is displayed.

func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error)


<WKReloadFrameErrorRecoveryAttempter: 0x281e9ab80>, NSErrorFailingURLStringKey=URL/XXXX.jsp?form1%3AhtmlFileTable%3A1%3A_id3.x=0&form1%3AhtmlFileTable%3A1%3A_id3.y=0&form1%3AhtmlParentFormId=&form1%3AhtmlDelMark=&form1%3AhtmlRowKeep=&com.sun.faces.VIEW=_id15%3A_id16&form1=form1, NSErrorFailingURLKey=URL/XXXX.jsp?form1%3AhtmlFileTable%3A1%3A_id3.x=0&form1%3AhtmlFileTable%3A1%3A_id3.y=0&form1%3AhtmlParentFormId=&form1%3AhtmlDelMark=&form1%3AhtmlRowKeep=&com.sun.faces.VIEW=_id15%3A_id16&form1=form1, NSLocalizedDescription="Frame Load Interrupted"}


Changes to be worried about

[iOS 13 Release Notes]

To enhance security, URLSession no longer sniffs the MIME type when the server sends Content-Type: application/octet-stream. (7820658)

From