I have an image as the data url and want my browser to download it as an image. The function below helps me solve this problem (it gets the data URL through the "data" argument):
function(data) {
var link = document.createElement("a");
link.download = "picture.jpg";
link.href = data;
link.click();
}
Since the size of the data url is less than 2 MB, it works fine in chrome. As soon as the size of the data url becomes more than 2 MB, chrome wants to download a file called "Download", and chrome shows a network failure.
I think this is due to restrictions on the maximum cache size (see getting the maximum Data-Uri size in Javascript ). Is there any way to increase this maximum size for data urls in my browser?
source
share