如何从正确的方式从Firebase存储获取pdf文件Angular 5

时间:2018-04-30 14:21:12

标签: firebase firebase-storage

我的应用程序包含存储在firebase存储中的pdf文件。

我想用ng2-pdf-viewer模块显示pdf。

   <app-pdf-view
          [src]="src"
          [original-size]="true"
          [fit-to-page]="false"
          [autoresize]="true"
          [rendertext]="true"
          [show-all]="false"
          [page]="pagenumber"
          (after-Load-Complete)="afterLoadComplete($event)"
          >
   </app-pdf-view>

当我在资源文件夹中的本地计算机上有文件时,它可以正常工作。

但是,当我想从firebase存储下载网址显示它时,我收到此错误:

     Failed to load https://firebasestorage.googleapis.com/v0/b/****.***.
        com/o/file-uploads%2Fcollections%2FYd8em6dN%2Fpages%2FrkevJ82Y?alt
        =media&token=0242276f-bf67-4b2c-be93-8d64a***: 

        No 'Access-Control-Allow-Origin' header is present on the requested resource. 
        Origin 'mysite.com' is therefore not allowed
        access. If an opaque response serves your needs, set the request's mode to '
        no-cors' to fetch the resource with CORS disabled.

我怎样才能让它发挥作用?

0 个答案:

没有答案