title: Error when downloading file from server ionic 4
body: <p>I am trying to download a file from my server but I keep getting errors. Been stuck for days on this. <a href="https://i.stack.imgur.com/QYPAb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QYPAb.png" alt="error"></a></p>
  
  <p><a href="https://i.stack.imgur.com/VEMz6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VEMz6.png" alt="enter image description here"></a></p>
  
  <p>HTML </p>
  
  <pre><code>&lt;ion-button expand="block" (click)="download()"&gt;Download Files&lt;/ion-button&gt;
  </code></pre>
  
  <p>TS</p>
  
  <pre><code>download() {
      const url = 'http://ccoulter12.lampt.eeecs.qub.ac.uk/api/files/5d248f949c71e.pdf';
      const path = this.file.dataDirectory;
      const transfer = this.transfer.create();
      transfer.download(url, path + 'myfile.pdf').then(entry =&gt; {
        const url = entry.toURL();
  
        if (this.platform.is('ios')) {
          // this.document.viewDocument(url, 'application/pdf', {});
          window.open(url);
        } else {
          this.fileOpener.open(url, 'application/pdf')
          .then(() =&gt; console.log('File is opened'))
          .catch(e =&gt; console.log('Error opening file', e));
      }
        });
      }
  </code></pre>