Skip to content

Commit

Permalink
first special save for ipad
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bonani committed Jun 8, 2022
1 parent 6f20d09 commit 38e8dd8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lib/download-blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ export default (filename, blob) => {
return;
}

// Special use on Ipad ThymioSuite
if (/ipad/i.test(navigator.userAgent)) {
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function () {
var base64data = reader.result;
window.webkit.messageHandlers.blobReady.postMessage({data: base64data, filename: filename});
}
}

if ('download' in HTMLAnchorElement.prototype) {
const url = window.URL.createObjectURL(blob);
downloadLink.href = url;
Expand All @@ -30,14 +40,5 @@ export default (filename, blob) => {
reader.readAsDataURL(blob);
}

// Special use on Ipad ThymioSuite
if (/ipad/i.test(navigator.userAgent)) {
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function () {
var base64data = reader.result;
window.webkit.messageHandlers.blobReady.postMessage({data: base64data, filename: filename});
}
}

};

0 comments on commit 38e8dd8

Please sign in to comment.