【问题标题】:How to use intent:// to open a PDF in Android Chrome and Angular (6)如何在Android Chrome和Angular中使用intent://打开PDF(六)
【发布时间】:2018-10-18 17:58:11
【问题描述】:

我有一个列出 PDF 的页面,一切正常,直到您尝试在 Android 上的 Chrome 中打开一个。我已经搜索并找到了使用“intent://”的引用,但无法弄清楚。

在我的组件中,我有以下附加到 URL 的意图路径

  intentPath = '#Intent;scheme=http;action=android.intent.action.VIEW;end';

并且链接本身是内置在组件中的:

  androidOpenPDF(url) {
    let newURL = url.replace('http', 'intent') + this.intentPath;
    window.open(newURL, "_blank");
  }

HTML 是:

<a class="btn" target="_blank" (click)="androidOpenPDF(pdfURL)">VIEW PDF</a>

【问题讨论】:

    标签: android angular google-chrome pdf android-intent


    【解决方案1】:

    我遇到了类似的问题,下面的代码对我有用:

    public void openPdf() {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.someurl.com/some-pdf"));
            startActivity(browserIntent);
    }
    

    【讨论】:

    • 谢谢,但那是在您使用应用程序时使用的。我的问题特定于 Angular 站点/html 页面。
    猜你喜欢
    • 1970-01-01
    • 2017-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 2015-10-18
    相关资源
    最近更新 更多