其它api可以正常调用,引入的js是//res.wx.qq.com/open/js/jweixin-1.2.0.js
同样一份文件 文件名称,文件大小一样,url不一样
wx.previewFile({
url: 'http://www.jining.gov.cn/attach/0/110120105620094.pdf',
name: '110120105620094.pdf',
size: 351299
}) // 可以预览 这里的url是原始链接
wx.previewFile({
url: 'https://oss01-yd01-hz-external.geely.com/demo-dev/2021/03/cd405eca-c7f0-4c5b-b41b-2693c03731ef.pdf?AWSAccessKeyId=DW67NWDQC1UF6ZZLYV03&Expires=4738876876&Signature=RU4%2B0PcFY6vasKvvGtSlE%2BMwwTc%3D',
name: '110120105620094.pdf',
size: 351299
}) // 把文件传到我们自己的云端服务上之后,ios预览就会失败了,提示下载失败,请检查网络后重试
// 而且云端这个文件大小也确定是351299 所以和文件size没关系 size是正确的
返回的http header不同
$curl -I 'http://www.jining.gov.cn/attach/0/110120105620094.pdf' HTTP/1.1 200 OK Date: Sat, 27 Mar 2021 05:44:19 GMT Content-Type: application/pdf Content-Length: 351299 Last-Modified: Tue, 20 Mar 2018 18:47:36 GMT ETag: "55c43-567dc820e6200" MS-Author-Via: DAV Accept-Ranges: bytes $curl -I 'https://oss01-yd01-hz-external.geely.com/demo-dev/2021/03/cd405eca-c7f0-4c5b-b41b-2693c03731ef.pdf\?AWSAccessKeyId\=DW67NWDQC1UF6ZZLYV03\&Expires\=4738876876\&Signature\=RU4%2B0PcFY6vasKvvGtSlE%2BMwwTc%3D' HTTP/1.1 403 Forbidden Server: nginx Date: Sat, 27 Mar 2021 05:43:59 GMT Content-Type: application/xml Content-Length: 234 Connection: keep-alive x-amz-request-id: tx00000000000000b27a8af-00605ec61f-289cb86-zone-4ee356 Accept-Ranges: bytes