iOS WKWebView Handle File Download

北慕城南 提交于 2019-12-06 06:20:12

问题


I am facing the following problem:

In a web interface, file downloads are triggered with an anchor tag, like this:

<a href="/bla/blabla" download>..</a>

While Safari browser can handle this request and open a dialogue to handle the file, WKWebView treats this just as an ordinary link and does nothing with it. I want to be able to get the file handler dialogue that is normally there when using Safari.

Right now there are 2 problems and I do not see an opening there yet:

  1. I can not detect a click on the element as it is treated just as a normal link. And I can not rely on the URL parameters to detect if it is a file since that is not constantly true.
  2. Even if the URL is defined as a one leading to a file, I can not pass it to Safari since it does not share session info and cookies with my app's WKWebView.

Therefore, I would like to know if there is any opening in handling files in iOS WKWebView. Thank you.

来源:https://stackoverflow.com/questions/48903293/ios-wkwebview-handle-file-download

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!