eligrey / eligrey/FileSaver.js

A question on URL.createObjectURL

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

Description

Hi all,
I have a question on the browser API `URL.createObjectURL`
https://github.com/eligrey/FileSaver.js/blob/master/src/FileSaver.js#L106
```
a.href = URL.createObjectURL(blob)
setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s
setTimeout(function () { click(a) }, 0)
```
What the purpose here by putting the `click` into the `setTimeout` function?

I found there's some problem when call `click` in sync way
[https://jsfiddle.net/1c8fnvwk/2/](https://jsfiddle.net/1c8fnvwk/2/)
But I didn't find any post describing the root cause.

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.