简体   繁体   中英

Ionic: Unable to open the PDF from URL in Android

Share my system environment:

Ionic:

   Ionic CLI          : 6.11.9 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res                          : 0.15.1
   native-run (update available: 1.2.1) : 1.1.0

System:

   NodeJS : v12.18.4 (/usr/local/bin/node)
   npm    : 6.14.8
   OS     : macOS Catalina

With Ionic 3 project, I wont able to display the PDF and http status code return is

206 Partial Content

I installed https://github.com/apache/cordova-plugin-inappbrowser for latest version. Here is my piece of code:

window.open('http://www.orimi.com/pdf-test.pdf', '_system');

Config.xml

<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />

please refer this link - https://ionicframework.com/docs/v3/native/in-app-browser/

import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';

constructor(private iab: InAppBrowser) { }

openPdf(){
  this.iab.create('http://www.orimi.com/pdf-test.pdf');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM