Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. if (openFile) {
  2. // Open blobs in new tab
  3. window.open(URL.createObjectURL(myBlob), "_blank");
  4. } else {
  5. // Edge workaroud for downloading file
  6. if (window.navigator && window.navigator.msSaveOrOpenBlob) {
  7. window.navigator.msSaveOrOpenBlob(myBlob, file.name);
  8. } else {
  9. let fileURL = URL.createObjectURL(myBlob);
  10. let a = document.createElement("a");
  11. a.href = fileURL;
  12. a.download = filenameFromHeader;
  13. document.body.appendChild(a);
  14. a.click();
  15. URL.revokeObjectURL(fileURL);
  16. }
  17. }
  18.  
  19. Content-Disposition: attachment; filename='myDocument.pdf'
  20. Content-Type: application/octet-stream
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement