diff options
| author | Teddy Wing | 2014-06-22 16:06:38 -0400 |
|---|---|---|
| committer | Teddy Wing | 2014-06-22 16:06:38 -0400 |
| commit | 305c5a154ab0ef01927ec4cecb12351b4b0ed126 (patch) | |
| tree | 5c3f99919eba00a669a9e424f59dde7b24e55e45 | |
| parent | 4156e9243bce1dfa9fa915d956ac7b3094e154be (diff) | |
| download | chrome-copy-urls-from-all-tabs-305c5a154ab0ef01927ec4cecb12351b4b0ed126.tar.bz2 | |
Fix downloaded filename 'download.txt' bug
As of Chrome 35, the downloaded file would appear with the filename
'download.txt' instead of the custom defined timestamped filename. Use a
JS blob instead of a data URL to download the file so that the filename
sticks.
| -rw-r--r-- | chrome-get-urls-from-tabs-in-windows.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/chrome-get-urls-from-tabs-in-windows.js b/chrome-get-urls-from-tabs-in-windows.js index c46fbf5..90682f2 100644 --- a/chrome-get-urls-from-tabs-in-windows.js +++ b/chrome-get-urls-from-tabs-in-windows.js @@ -98,7 +98,8 @@ generate_backup_text(function(backup_text) { create_download_link = function(text, callback) { generate_filename(function(filename) { var download_link = document.createElement('a'); - download_link.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); + var blob = new Blob([text], { type: 'text/plain' }); + download_link.setAttribute('href', window.URL.createObjectURL(blob)); download_link.setAttribute('download', filename); download_link.innerHTML = 'Download file'; |
