jszip icon indicating copy to clipboard operation
jszip copied to clipboard

jszip doesn't work in OS X safari 9.1

Open leonardsims opened this issue 9 years ago • 9 comments

I tested jszip in osx safari 9.1.

but It doesn't work.

the console error message is "Failed to load resource: frame load interrupted"

please check this issue

thank you

leonardsims avatar Apr 20 '16 07:04 leonardsims

Could you provide a code snippet of what triggers the issue ?

dduponchel avatar Apr 20 '16 18:04 dduponchel

var zip = new JSZip(); zip.file("Hello.txt", "Hello World\n"); var img = zip.folder("images"); img.file("smile.gif", imgData, {base64: true}); zip.generateAsync({type:"blob"}) .then(function(content) { // see FileSaver.js saveAs(content, "example.zip"); }); I tested for this source in this site(http://stuk.github.io/jszip). When I click RUN (in osx safari 9.1). It's not working with this message "Failed to load resource: frame load interrupted"

leonardsims avatar Apr 21 '16 00:04 leonardsims

I think it is linked to eligrey/FileSaver.js/issues/12. Could you try

var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
zip.generateAsync({type:"blob"})
.then(function(content) {
    try {
        saveAs(content, "example.zip");
    } catch (e) {
        alert("saveAs failed with " + e);
    }
}).catch(function (e) {
    alert("JSZip failed with " + e);
});

?

dduponchel avatar Apr 21 '16 15:04 dduponchel

Same error here. Code snippet didn't work.

SkyHacks avatar Apr 26 '16 15:04 SkyHacks

I tried that but It didn't work. I think blob type is not working at Safari.

leonardsims avatar Apr 29 '16 08:04 leonardsims

I reckon it has something to do with the fact that the File constructor is not supported in Safari - CanIUse

@Stuk

ar7casper avatar Sep 04 '16 14:09 ar7casper

If there is a way to set the type of the Blob in generateAsync to "application/octet-stream", that might solve the problem partially. Safari would commence the download but with the name of unknown and without any extension.

davejack1 avatar Sep 26 '16 00:09 davejack1

If there is a way to set the type of the Blob in generateAsync to "application/octet-stream"

It's the mimeType option:

zip.generateAsync({
    type: "blob",
    mimeType: "application/octet-stream"
})

dduponchel avatar Sep 26 '16 05:09 dduponchel

Did you get this to work on iPad? Thanks

kejsiStruga avatar Jan 11 '18 19:01 kejsiStruga