title: Cordova/PhoneGap Open Downloaded File (InAppBrowser)
body: <p>Using Cordova/PhoneGap 3.3.0, I am downloading a file using the FileTransfer plugin, and then trying to open it using the InAppBrowser plugin.  <strong>I can download the file successfully</strong>, and place it in the temp directory.  Since the File plugin now uses URL schema, I cannot figure out how to pass the correct url/path to the <code>window.open</code> method of the InAppBrowser plugin.  I cannot find any relevant documentation either.  All of the "download and open" documentation I can find is out of date and pre-URL-schema.</p>
  
  <p><strong>Relevant links:</strong></p>
  
  <ul>
  <li><a href="http://cordova.apache.org/news/2014/02/10/plugins-release.html" rel="nofollow noreferrer">Cordova Release info on New Plugin Versions</a></li>
  <li><a href="https://github.com/apache/cordova-plugin-file-transfer/blob/master/doc/index.md#download" rel="nofollow noreferrer">The readme for the FileTransfer plugin</a></li>
  <li><a href="https://github.com/apache/cordova-plugin-inappbrowser/blob/master/doc/index.md" rel="nofollow noreferrer">The readme for the InAppBrowser plugin</a></li>
  <li><a href="https://stackoverflow.com/questions/21831443/how-to-open-local-file-with-inappbrowser-with-recent-changes-to-url-scheme-in-fi#comment33197604_21831443">How to open local file with InAppBrowser with recent changes to URL scheme in File plugin</a> - Similar question</li>
  </ul>
  
  <p><strong>Out of date examples I found:</strong></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/19978369/file-transfer-download-file-issue-on-cordova-3-1">File-transfer download file issue on Cordova 3.1</a> - This user downgraded to an earlier version because they couldn't figure it out</li>
  <li><a href="https://gist.github.com/devgeeks/4982983" rel="nofollow noreferrer">https://gist.github.com/devgeeks/4982983</a> - This example uses <code>entry.fullPath</code>, which is now deprecated in favor of <code>toURL()</code></li>
  </ul>
  
  <p>Here is my code:</p>
  
  <pre><code>var uri = encodeURI("http://some.url/file.pdf");
  window.requestFileSystem(LocalFileSystem.TEMPORARY, 0,
      function (fileSystem) {
          var fileTransfer = new FileTransfer();
          var filename = fileSystem.root.toURL() + uri.substr(uri.lastIndexOf("/") + 1);
          fileTransfer.download(uri, filename,
              function(entry) { // download success
                  var path = entry.toURL(); //**THIS IS WHAT I NEED**
                  window.open(path, "_system");
              },
              function(error) {} // irrelevant download error
          );
      },
      function(error) {} // irrelevant request fileSystem error
  );
  </code></pre>
  
  <p>I am currently testing in Android on a Nexus 7 and Nexus 5.  The InAppBrowser correctly opens the default pdf launcher (in my case Adobe Reader), but then I get a "The document path is not valid" error.</p>
  
  <p><strong>[Update: showing return values]</strong></p>
  
  <p>I have tried all of the following combinations for the file path:</p>
  
  <pre><code>var path = entry.toURL(); // "cdvfile://localhost/temporary/file.pdf"
  var path = entry.fullPath; // "file.pdf"
  var path = fileSystem.root.toURL() + filename; // "cdvfile://localhost/temporary/file.pdf"
  var path = fileSystem.root.fullPath + filename; // "/file.pdf"
  </code></pre>