问题
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