fix: blob download in internet explorer (#4256)

This commit is contained in:
kovyfive
2018-02-27 23:13:14 +01:00
committed by kyle
parent 71d7c1a5ab
commit 6f7a4c3097

View File

@@ -3,6 +3,7 @@ import PropTypes from "prop-types"
import formatXml from "xml-but-prettier"
import lowerCase from "lodash/lowerCase"
import { extractFileNameFromContentDispositionHeader } from "core/utils"
import win from "core/window"
export default class ResponseBody extends React.Component {
@@ -47,7 +48,11 @@ export default class ResponseBody extends React.Component {
}
}
bodyEl = <div><a href={ href } download={ download }>{ "Download file" }</a></div>
if(win.navigator && win.navigator.msSaveOrOpenBlob) {
bodyEl = <div><a href={ href } onClick={() => win.navigator.msSaveOrOpenBlob(blob, download)}>{ "Download file" }</a></div>
} else {
bodyEl = <div><a href={ href } download={ download }>{ "Download file" }</a></div>
}
} else {
bodyEl = <pre>Download headers detected but your browser does not support downloading binary via XHR (Blob).</pre>
}