I am trying to show an image or a document coming from an AWS S3 Pre-Signed URL in my react application. Following is my code.
this.props.getS3SignedURL(key).then(url=> {
this.setState({ isLoading: false, error: "", url: url});
window.location = url;
}, err => {
//err
});
It works without any issue in Google Chrome, it displays the document. But in Microsoft Edge and IE the location doesn't change.
I tried with encodeURI(), encodeURIComponent() and window.location.href all combinations. But can't get it to work in Edge and IE. I tried with google document viewer as mentioned here. Still it's not working, and I suspect whether I can user Google document viewer because the document coming from the url can be an image/pdf/xls etc.