From 4156e9243bce1dfa9fa915d956ac7b3094e154be Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 12 Jun 2014 21:46:46 -0400 Subject: Update TODO Add entry for the `download.txt` filename bug. --- TODO | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TODO b/TODO index 0c3340c..3e9332c 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,11 @@ TODO ==== +2014.06.12: +- Fix Chrome download link bug (filename appears as `download.txt`). See: + https://code.google.com/p/chromium/issues/detail?id=375634 + http://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file/18197511#comment36775212_18197511 + 2014.03.30: v Better fonts v Move download link -- cgit v1.2.3 From 305c5a154ab0ef01927ec4cecb12351b4b0ed126 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 22 Jun 2014 16:06:38 -0400 Subject: 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. --- chrome-get-urls-from-tabs-in-windows.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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'; -- cgit v1.2.3 From 47eaea3fbb49b03c09e74ab152a8d52d3fcc7fad Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 22 Jun 2014 16:11:08 -0400 Subject: TODO: update, fix for 'download.txt' filename bug --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index 3e9332c..b183258 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ TODO ==== 2014.06.12: -- Fix Chrome download link bug (filename appears as `download.txt`). See: +v Fix Chrome download link bug (filename appears as `download.txt`). See: https://code.google.com/p/chromium/issues/detail?id=375634 http://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file/18197511#comment36775212_18197511 -- cgit v1.2.3