title: Downloading a file using web view
body: <p>In a project, i want to download mp3 files in a http page loaded in web view. Downloaded files could be opened by apps like phone drive or dropbox.</p>
  
  <p>When user click to the link in web view it should download it to iphone.</p>
  
  <p>In server side, mp3 files are located outside of webroot. So, the link for download is something like "download.php?id=554"</p>
  
  <p>Anyone can help me on this subject ?
  I wonder is there a way to achieve this. Thanks</p>
  
  <p>EDIT</p>
  
  <p>I added this delegate </p>
  
  <pre><code>func webView(webView: UIWebView!, shouldStartLoadWithRequest request: NSURLRequest!, navigationType: UIWebViewNavigationType) -&gt; Bool {
  
          var urlm = request.URL.absoluteURL?.absoluteString
  
          if urlm?.rangeOfString("filename") != nil{
  
              print(urlm)
  
              //code to download (I NEED IT TOO) 
  
              return false
          }
  
  
      return true
      }
  </code></pre>
  
  <p>But still don't know how to download ?</p>