0% found this document useful (0 votes)
59 views1 page

DFGFH 2

The document contains a JavaScript function 'saveAs' which allows users to save files on the client side. It includes checks for browser compatibility and handles different scenarios for creating download links. The function utilizes the URL API and MouseEvent to trigger downloads in supported browsers.

Uploaded by

vanek198804
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views1 page

DFGFH 2

The document contains a JavaScript function 'saveAs' which allows users to save files on the client side. It includes checks for browser compatibility and handles different scenarios for creating download links. The function utilizes the URL API and MouseEvent to trigger downloads in supported browsers.

Uploaded by

vanek198804
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.

js */
var saveAs = saveAs || function(e) {
"use strict";
if (typeof e === "undefined" || typeof navigator !== "undefined" && /MSIE [1-
9]\./.test(navigator.userAgent)) {
return
}
var t = e.document
, n = function() {
return e.URL || e.webkitURL || e
}
, r = t.createElementNS("http://www.w3.org/1999/xhtml", "a")
, o = "download"in r
, a = function(e) {
var t = new MouseEvent("click");
e.dispatchEvent(t)
}
, i = /constructor/i.test(e.HTMLElement) || e.safari
, f = /CriOS\/[\d]+/.test(navigator.userAgent)
, u = function(t) {
(e.setImmediate || e.setTimeout)(function() {
throw t
}, 0)
}
, s = "application/octet-stream"
, d = 1e3 * 40
, c = function(e) {
var t = function() {
if (typeof e === "string") {
n().revokeObjectURL(e)
} else {
e.remove()
}
};
setTimeout(t, d)
}
, l = function(e, t, n) {
t = [].concat(t);
var r = t.length;
while (r--) {

You might also like