Save or open blob using FileSaver.js on iOS Chrome and Safari

I am using docxtemplater to create a docx document from javascript.

On desktop browsers, it works fine. There are no problems on mobile on Android, but I have a problem with iOS.

In iOS, when I try to load or open a document, a new tab is created in the browser when I see a URL like:

blob:http://mylocalServer/987788-3524-33iuhih3334434434 

On this new tab, I do not see the document, and I have no way to download it.

How can I find a solution to get docx document in iOS?

Here is the code for creating a docx document in JS:

 out=doc.getZip().generate({type:"blob"}); // Give a name for the output word document var outputName = "test.docx" ; saveAs(out,outputName); 

The saveAs function is called in the FileSaver.js file:

And when the action is executed on iOS, we are going to throw away this code:

 fs_error = function() { // don't create more object URLs than needed if (blob_changed || !object_url) { object_url = get_URL().createObjectURL(blob); } if (target_view) { target_view.location.href = object_url; } else { var new_tab = view.open(object_url, "_blank"); if (new_tab == undefined && typeof safari !== "undefined") { //Apple do not allow window.open, see http://bit.ly/1kZffRI view.location.href = object_url } } filesaver.readyState = filesaver.DONE; dispatch_all(); revoke(object_url); } 
+7
javascript google-chrome ios blob
source share

No one has answered this question yet.

See related questions:

1895
Open the url in a new tab (not in a new window) using JavaScript
1554
Disabling Chrome Web Site Cache
1403
Disable same origin policy in Chrome
1153
How to force ASP.NET Web API to return JSON instead of XML using Chrome?
1058
Getting Chrome to accept a self-signed local certificate
1001
Is Safari iOS 6 caching $ .ajax results?
949
How to remove border (contour) around text / input fields? (Chromium)
593
How to set JavaScript breakpoint from code in Chrome?
one
BLOB URL not working in Safari

All Articles