2***@qq.com
2***@qq.com
  • 发布:2024-11-14 08:49
  • 更新:2024-11-14 09:37
  • 阅读:42

(鸿蒙)harmonyOS next 预览pdf 文件有无解决方案 ?

分类:uni-app

目前用的是pdf.js插件预览 (web-view绑定viewer.html?file=xx),安卓没有问题,鸿蒙会报:

Access to XMLHttpRequest at 'resource://rawfile/apps/HBuilder/www/static/pdf/web/locale/locale.properties' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, arkweb, data, chrome-extension, chrome, https, chrome-untrusted.

Access to XMLHttpRequest at 'https://xx.xx.xx/xx/api/file/xx/preview?fileName=xx.pdf&filePath=/file/xx/02' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

想问问各位大佬有没有遇到这个问题?或者有其他的预览文件的解决方案?

2024-11-14 08:49 负责人:无 分享
已邀请:
靐齉齾麤龖龗

靐齉齾麤龖龗 - 解决不了问题,那就解决提出问题的人

你去那个文件夹里面找到viewer.[m]js里面搜 HOSTED_VIEWER_ORIGINS 这个,添加一个resource://试试

要回复问题请先登录注册