0

Can any one please suggest, how to create mhtml file using JavaScript?

I have tried to use Content-Type: 'message/rfc822', it downloads mhtml file but when open it in IE there is an empty page.

Luca Kiebel
  • 9,790
  • 7
  • 29
  • 44
Qasim Rizvi
  • 99
  • 1
  • 9
  • 1
    Can you show what you tried? – epascarello Sep 12 '18 at 13:22
  • used these headers `From: Snapshot-Content-Location: https://developer.mozilla.org/en-US/docs/Web/API/Headers/append Subject: Headers.append() - Web APIs | MDN Date: Thu, 12 Sep 2018 09:54:31 -0000 MIME-Version: 1.0 Content-Type: multipart/related; type="text/html"; boundary="----MultipartBoundary--5sRtHLtn7e4WLeVgGR26oU0v4JlNZrwxitQfdTJZh2----"` – Qasim Rizvi Sep 12 '18 at 13:33
  • then this function to download file `function exportFile(fileContent, downloadLinkId) { var data = new Blob([fileContent], { type: 'message/rfc822' }); objUrl = window.URL.createObjectURL(data); var downloadLinkButton = document.getElementById(downloadLinkId); downloadLinkButton.href = objUrl; };` where in content pass my html with upper mentioned headers – Qasim Rizvi Sep 12 '18 at 13:35

0 Answers0