目前用的是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.
想问问各位大佬有没有遇到这个问题?或者有其他的预览文件的解决方案?
1 个回复
靐齉齾麤龖龗 - 解决不了问题,那就解决提出问题的人
你去那个文件夹里面找到viewer.[m]js里面搜 HOSTED_VIEWER_ORIGINS 这个,添加一个resource://试试