问题:使用pdf.js双方跨域
viewer.html?file=http://www.chuanbaofund.com/关于《川宝车厘子自由一号私募证券投资基金》成立的公告.pdf:1 Access to fetch at 'xx/xx.pdf' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
方案:
步骤1:
注释掉pdf.js里的1846-1848行,先使自己的项目能跨域
pdf.js使用问题

步骤2:
服务器设置http:响应头
pdf.js使用问题

但是放到服务器又发现一个问题,pdf.js功能都变成英文了,
所以需要配置以下
pdf.js使用问题

引用连接:
https://my.oschina.net/tigerBin/blog/1802998
https://www.cnblogs.com/sharestone/p/7105486.html

相关文章:

  • 2021-09-22
  • 2022-02-01
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2021-04-30
  • 2022-01-05
  • 2021-04-19
  • 2021-09-17
  • 2021-08-17
相关资源
相似解决方案