react-file-download
Advanced tools
Comparing version
@@ -13,9 +13,19 @@ module.exports = function(data, filename, mime) { | ||
var tempLink = document.createElement('a'); | ||
tempLink.style.display = 'none'; | ||
tempLink.href = blobURL; | ||
tempLink.setAttribute('download', filename); | ||
tempLink.setAttribute('target', '_blank'); | ||
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 | ||
// is enabled. | ||
if (typeof tempLink.download === 'undefined') { | ||
tempLink.setAttribute('target', '_blank'); | ||
} | ||
document.body.appendChild(tempLink); | ||
tempLink.click(); | ||
document.body.removeChild(tempLink); | ||
window.URL.revokeObjectURL(blobURL); | ||
} | ||
} |
{ | ||
"name": "react-file-download", | ||
"version": "0.3.4", | ||
"description": "React component that trigger browser to save javascript-generated content to a file", | ||
"version": "0.3.5", | ||
"description": "This package has been deprecated! Please use js-file-download instead", | ||
"main": "file-download.js", | ||
@@ -11,3 +11,3 @@ "scripts": { | ||
"type": "git", | ||
"url": "git@github.com:kennethjiang/react-file-download.git" | ||
"url": "git@github.com:kennethjiang/js-file-download.git" | ||
}, | ||
@@ -23,5 +23,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/Rhumbix/react-file-download/issues" | ||
"url": "https://github.com/kennethjiang/js-file-download/issues" | ||
}, | ||
"homepage": "https://github.com/Rhumbix/react-file-download" | ||
"homepage": "https://github.com/kennethjiang/js-file-download" | ||
} |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
4751
45.2%8
14.29%28
40%1
-50%2
-33.33%