vendredi 8 mai 2015

How to save zip file with file extension in Safari 8 using jszip?

I want to save zip file on client side using jszip library.

Here is my code:

function zipDownload(){
    var fileName ="test.zip",
        zip = new JSZip(),
        content,
        img,
        data;

    zip.file("hello.txt", "Hello World\n");
    data = zip.generate({type: $.isFunction(window.Blob) ? "blob" : "base64"});
    fileLoader.saveAs(fileName, "application/zip", data);
}

It works fine in all modern browsers except Safari 8.

Safari 8 can't save file with file extension.

This is a sample http://ift.tt/1ceVdoE that shows this issue in action.

Aucun commentaire:

Enregistrer un commentaire