Search code examples
google-chrome-apphtml5-filesystem

Access downloaded pdf file path in HTML5 file system and display it in webview


In my chrome app, I am using HTML5 file system to save the pdf files to sand box.Downloading is working fine.But how do i access that downloaded file path? I want to give that path as webview source.


Solution

  • The best way, if it works, would be to use a filesystem URL. To get this use FileEntry.toURL

    These don't work on external files (i.e. files that come from chrome.fileSystem.chooseEntry and are outside the app's sandbox) but should work for files in the app's sandbox.

    Note, I am referring to filesystem:// urls not file://urls, which won't work as Marc Rochkind has pointed out in his answer.

    Disclaimer: I haven't tested this, but I believe it should work.