Muthukamatchi Ganesan
Muthukamatchi Ganesan

Reputation: 373

Download not happened when the file size exceeding 1.5 MB

I have a case, when a user click a download button, did some process and create a raw HTML content and make it download as zip file to the client side.

I tried the below code and it is working fine up to the content size is 1.5 MB. But if the content size is exceeding 1.5 MB it didn't download, as well as didn't show any error or warning.

var link = document.createElement('a');
link.download = "Test.zip";
link.href = 'data:application/zip;base64,' + content;
link.click();

What may be the reason for that?

Upvotes: 2

Views: 486

Answers (2)

Orhan Tuncer
Orhan Tuncer

Reputation: 154

Updated

As Kizer suggested the problem seems to be about Data URI limitations.

This might be of help : FileSaver.js

Upvotes: 1

Kizer
Kizer

Reputation: 1666

You may be hitting a size limit in the data: URI scheme. Some browsers impose a limit on the size of the resource represented by a data: URI. See http://caniuse.com/#feat=datauri.

Upvotes: 1

Related Questions