aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2014-06-22 16:06:38 -0400
committerTeddy Wing2014-06-22 16:06:38 -0400
commit305c5a154ab0ef01927ec4cecb12351b4b0ed126 (patch)
tree5c3f99919eba00a669a9e424f59dde7b24e55e45
parent4156e9243bce1dfa9fa915d956ac7b3094e154be (diff)
downloadchrome-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.js3
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';