【发布时间】:2020-05-04 23:27:56
【问题描述】:
我正在尝试使用 iframe 标记嵌入“Office Web Apps Viewer”以在我的网站上显示电子表格预览。我尝试使用 encodeURIComponent 对 url 进行编码,但它显示“我们正在获取您的文件”加载栏,但没有任何反应。提前致谢。
const originalUrl ="https://exampleDomain.amazonaws.com/Folder/Filename.xlsx?algorithm=algorithmName&credential=region&date=date&expires=time&token=encryptedToken&signature=encryptedSignature&headers=example"
const encodedUrl = encodeURIComponent(originalUrl);
const iFrameUrl = `https://view.officeapps.live.com/op/embed.aspx?src=${encodedUrl}`;
<iframe title="l" src={iFrameUrl} style={{ maxHeight: 'auto', maxWidth: 'auto'}} />
注意:上面的代码可以通过替换 src = https://docs.google.com/viewer?url=yourUrl&embedded=true 与 google 文档一起使用
【问题讨论】:
-
你有没有检查你的浏览器控制台,看看有没有什么可看的?您是否检查过 S3 存储桶日志以查看是否正在发生访问尝试但参数错误?
-
我们也面临这个问题。签名的 s3 URL 不起作用。谁有解决办法?
-
我有同样的问题,但使用的是谷歌云存储。我相信 Office Web Apps 查看器可以轻松处理 URL。 stackoverflow.com/questions/61815774/…
标签: javascript amazon-s3 office365 ms-office