[GUIDE] Downloading Image, PDF and Music files in iOS WebView

Want to use WebView to save PDF and image files to your user’s phone or tablet? This is the way to do it:

 

  • Download the Xcode WebViewGold template for iOS hereOr book our full all-inclusive WeSetupYourWebViewApp service.
  • Save PDF files by calling links with .pdf suffix:
        <a href="http://www.example.org/file.pdf">Link</a>
  • Save images to the camera roll of the user by running this script on your website:
    <script>
        var imgurl = "https://www.example.org/example.png"; //Image URL
        window.location.href = "savethisimage://?url="+ imgurl +"";
        <script>
    
  • Save Music files by calling links with .mp3, .mp4 or .wav suffix:
  • <a href="http://www.example.org/file.mp3">Link mp3</a>
    <a href="http://www.example.org/file.mp4">Link mp4</a>
    <a href="http://www.example.org/file.wav">Link wav</a>
    
    

Done, that’s it! 😉 Happy coding!