Skip to content

Instantly share code, notes, and snippets.

@ruimarques
Created November 21, 2018 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruimarques/a91cc0f75d9fc9d3716567aa7a90b66c to your computer and use it in GitHub Desktop.
Save ruimarques/a91cc0f75d9fc9d3716567aa7a90b66c to your computer and use it in GitHub Desktop.
private openDocument(targetWindow: Window, blob: Blob) {
if (this.useIEBlobStrategy()) {
targetWindow.navigator.msSaveOrOpenBlob(blob);
} else {
const objectUrl = URL.createObjectURL(blob);
targetWindow.location.assign(objectUrl);
}
}
useIEBlobStrategy(): boolean {
return !!(window && window.navigator && window.navigator.msSaveOrOpenBlob);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment