SHARE
TWEET

Untitled

a guest Jun 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top