eligrey / eligrey/FileSaver.js

Cannot use blob value in saveAs from Instagram In-App Browser

Open
#754 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

a solution like:
```js
saveAs("original-file.pdf", "new-file.pdf");
```
works fine in every browser i've checked also instagram browser.

But a solution based on download a blob content does not work on Instagram In-APP (but is working on Chrome, and "regular" browsers).

```js
var url = "file.pdf";
var name = "test";
var opts = "";

var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.responseType = 'blob';

xhr.onload = function () {
const blob = new Blob([xhr.response], { type: 'application/pdf' });
saveAs(blob, name);
};

xhr.onerror = function () {
console.error('could not download file');
};

xhr.send();
```

i've been debugging for a couple of hours and i cant really know what is happening

Any idea is welcomed

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.