Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (openFile) {
- // Open blobs in new tab
- window.open(URL.createObjectURL(myBlob), "_blank");
- } else {
- // Edge workaroud for downloading file
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
- window.navigator.msSaveOrOpenBlob(myBlob, file.name);
- } else {
- let fileURL = URL.createObjectURL(myBlob);
- let a = document.createElement("a");
- a.href = fileURL;
- a.download = filenameFromHeader;
- document.body.appendChild(a);
- a.click();
- URL.revokeObjectURL(fileURL);
- }
- }
- Content-Disposition: attachment; filename='myDocument.pdf'
- Content-Type: application/octet-stream
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement