[GUIDE] Downloading PDF and Images 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 WebView for Android Studio here.
  • 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>
    
    

Done, that’s it! 😉 Happy coding!