Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: download file on SamsungBrowser with block auto download (fixes #660) #661

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dist/FileSaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@


var isMacOSWebView = /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent);
var isSamsungBrowser = /SamsungBrowser/.test(navigator.userAgent);
var saveAs = _global.saveAs || ( // probably in some web worker
typeof window !== 'object' || window !== _global ? function saveAs() {}
/* noop */
Expand Down Expand Up @@ -118,9 +119,14 @@
URL.revokeObjectURL(a.href);
}, 4E4); // 40s

setTimeout(function () {
if (isSamsungBrowser) {
// SamsungBrowser blocks by default "auto downloads" i.e. not initiated by user interaction (#660)
click(a);
}, 0);
} else {
setTimeout(function () {
click(a);
}, 0);
}
}
} // Use msSaveOrOpenBlob as a second approach
: 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) {
Expand Down
2 changes: 1 addition & 1 deletion dist/FileSaver.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading