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

  • Home
  • Android
  • [GUIDE] Downloading Image, PDF and Music files in Android WebView apps

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

 

  • Download the WebViewGold template for Android Studio here.
    or 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!