I use docxtemplater library to create a docx document from javascript.
On desktop browsers, it works fine. On mobile, no problem on Android but i have some issue on iOS.
On iOS, when i try to download or open the document, a new tab is created in the browser when i can see an URL of type :
blob:http://mylocalServer/987788-3524-33iuhih3334434434
In this new tab, i can't see the document and i don't have any way to download it.
How can i have a solution to retrieve the docx document under iOS ?
Here is the code for creating the 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);
saveAs function is called in FileSaver.js file :
And when the action is done on iOS, we are going throw 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);
}