I have a page that lists PDFs and everything works fine until you try and open one in Chrome on Android. I have searched and found references to using 'intent://' but have not been able to figure it out.
In my component I have the following intent path that I append to the URL
intentPath = '#Intent;scheme=http;action=android.intent.action.VIEW;end';
And the link itself is built in the component with:
androidOpenPDF(url) {
let newURL = url.replace('http', 'intent') + this.intentPath;
window.open(newURL, "_blank");
}
The HTMl is:
<a class="btn" target="_blank" (click)="androidOpenPDF(pdfURL)">VIEW PDF</a>
I had a similar problem the below code worked for me :
public void openPdf() {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.someurl.com/some-pdf"));
startActivity(browserIntent);
}
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.