js-file-download
Advanced tools
Comparing version 0.4.9 to 0.4.10
@@ -5,5 +5,5 @@ module.exports = function(data, filename, mime, bom) { | ||
if (typeof window.navigator.msSaveBlob !== 'undefined') { | ||
// IE workaround for "HTML7007: One or more blob URLs were | ||
// revoked by closing the blob for which they were created. | ||
// These URLs will no longer resolve as the data backing | ||
// IE workaround for "HTML7007: One or more blob URLs were | ||
// revoked by closing the blob for which they were created. | ||
// These URLs will no longer resolve as the data backing | ||
// the URL has been freed." | ||
@@ -13,11 +13,11 @@ window.navigator.msSaveBlob(blob, filename); | ||
else { | ||
var blobURL = window.URL.createObjectURL(blob); | ||
var blobURL = (window.URL ? window.URL : window.webkitURL).createObjectURL(blob); | ||
var tempLink = document.createElement('a'); | ||
tempLink.style.display = 'none'; | ||
tempLink.href = blobURL; | ||
tempLink.setAttribute('download', filename); | ||
tempLink.setAttribute('download', filename); | ||
// Safari thinks _blank anchor are pop ups. We only want to set _blank | ||
// target if the browser does not support the HTML5 download attribute. | ||
// This allows you to download files in desktop safari if pop up blocking | ||
// This allows you to download files in desktop safari if pop up blocking | ||
// is enabled. | ||
@@ -27,6 +27,6 @@ if (typeof tempLink.download === 'undefined') { | ||
} | ||
document.body.appendChild(tempLink); | ||
tempLink.click(); | ||
// Fixes "webkit blob resource error 1" | ||
@@ -33,0 +33,0 @@ setTimeout(function() { |
{ | ||
"name": "js-file-download", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"description": "Javascript function that triggers browser to save javascript-generated content to a file", | ||
@@ -5,0 +5,0 @@ "main": "file-download.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4514