Detecting Download in UIWebView

前端 未结 3 1430
走了就别回头了
走了就别回头了 2020-12-17 03:44

I have a programatically crated UIWebView, and it is used to browse a iPhone-style site stored on my server. In this website, there are a few links to files use

3条回答
  •  隐瞒了意图╮
    2020-12-17 04:47

    So here's the problem: UIWebView doesn't download anything it can't display, and it doesn't know how to display a ZIP file. It will always fail before the Content-Type is filled in.

    So, what to do? I don't know if your server-side app runs on more than the iPhone, but you could register a custom URL scheme with links like myapplication://example.com/stuff/yourhexurlgoeshere. You can create a custom URL handler for the myapplication scheme. A couple of seconds of Googling produced this site, which explains how to do it.

    This has an additional benefit because if you, say, emailed such a link to another user, they could tap on it in Mail and have it open in your application.

提交回复
热议问题