قالب وردپرس درنا توس
Home / IOS Development / javascript – "download" attribute option in safari / iOS

javascript – "download" attribute option in safari / iOS



I have a blob made with a base64, and I have to make this data downloadable as a pdf.

I created this tag:

      was blob = new Blob ([byte]);
var link = document.createElement (& # 39; a & # 39;);

link.href = window.URL.createObjectURL (blob);
link.target = & # 39; _blank & # 39 ;;
was filename = name + & # 39; .pdf & # 39 ;;
link.download = fileName;
link.click ();

The file is actually downloaded, but the name is called "unknown", so it may not be open since the extension is lost.

It works on all browsers, except safari mobile on iOS. The problem is that the download attribute lacks support on this browser and IE.

There are many solutions for IE, but I didn't find any for safari / iOS.

Do you know how to download a blob came from a base64 (no XHR involved) in this browser?

Thank you


Source link