Amazon S3 Signed Url is not working with Office Web Apps Viewer (encodeURIComponent not working)

筅森魡賤 提交于 2020-05-17 07:42:07

问题


I am trying to embed 'Office Web Apps Viewer' with iframe tag to show spreadsheet preview on my website. I tried with encodeURIComponent for encoding the url but its showing "we are fetching your file" loading bar but nothing happens. thanks in advance.

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'}} />

Note: the above code work with google docs by replacing src = https://docs.google.com/viewer?url=yourUrl&embedded=true

来源:https://stackoverflow.com/questions/59798131/amazon-s3-signed-url-is-not-working-with-office-web-apps-viewer-encodeuricompon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!