Cordova Filetransfer a pdf file from app to device | Using Monaca IDE
<p>Alright so I've downloaded the plugin from the Monaca/Cordova plugin repository. Then I added the javascript from the FileTransfer plugin site for the download and replaced the encodeURI with the file path. </p>

<p><a href="https://www.npmjs.com/package/cordova-plugin-file-transfer#download" rel="nofollow">https://www.npmjs.com/package/cordova-plugin-file-transfer#download</a></p>

<pre><code>&lt;script&gt;
    var fileTransfer = new FileTransfer();
var uri = encodeURI("http://www.ulc.org/wp-content/uploads/2012/09/King-James-Bible-KJV-Bible-PDF.pdf");

fileTransfer.download(
    uri,
    fileURL,
    function(entry) {
        console.log("download complete: " + entry.toURL());
    },
    function(error) {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("upload error code" + error.code);
    },
    false,
    {
        headers: {
            "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
        }
    }
);
&lt;/script&gt;
</code></pre>

<p>I'm trying to call it with an onclick function using html..</p>

<pre><code>&lt;button onclick="FileTransfer()"&gt;Download&lt;/button&gt; 
</code></pre>

<p>It doesn't work though, how can I get the file to download onclick to their device?</p>