Download base64 data using javascript | IE11
<p>I am trying to download base64 data using “window.location.href” in JavaScript. It works fine in Chrome but the same code is not working in IE11.</p>

<p>Could you please let me know the fix or a workaround for the same?</p>

<p>Here is the code:
Javascript:</p>

<pre><code>function DownloadPdf() {
window.location.href = "data:application/pdf;base64,JVBERi0xLjMNJeLjz9MNCj........Pg1zdGFydHhyZWYNMTczDSUlRU9GDQ=="
</code></pre>

<p>}</p>

<pre><code>function DownloadExcel() {
window.location.href = "data:application/vnd.ms-excel;base64,UEsDBBQABgAIAAAAIQB......BLBQYAAAAACgAKAIACAACzHAAAAAA="
}
</code></pre>

<p>HTML:

</p>

<p>NOTE:</p>

<p>I am developing an offline website where I am storing file in browser localStorage in base64 string format which is not connected to server. I don’t have any physical file present. </p>