From 45d4d2241b6c9d4e2cea528eb41677c4ac5be241 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 12 Jun 2014 09:58:02 -0700 Subject: [PATCH] Chromium now follows Firefox's policy on the download attribute. --- src/Menu/DownloadLink.coffee | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Menu/DownloadLink.coffee b/src/Menu/DownloadLink.coffee index 8da1cb882..21cc8e9dc 100755 --- a/src/Menu/DownloadLink.coffee +++ b/src/Menu/DownloadLink.coffee @@ -6,19 +6,16 @@ DownloadLink = className: 'download-link' textContent: 'Download file' - <% if (type === 'userscript') { %> - unless chrome? - # Firefox places same-origin restrictions on links with the download attribute. - $.on a, 'click', (e) -> - return true if @protocol is 'blob:' - e.preventDefault() - CrossOrigin.request @href, (blob) => - if blob - @href = URL.createObjectURL blob - @click() - else - new Notice 'error', "Could not download #{file.URL}", 30 - <% } %> + # Specifying the filename with the download attribute only works for same-origin links. + $.on a, 'click', (e) -> + return true if @protocol is 'blob:' + e.preventDefault() + CrossOrigin.request @href, (blob) => + if blob + @href = URL.createObjectURL blob + @click() + else + new Notice 'error', "Could not download #{file.URL}", 30 $.event 'AddMenuEntry', type: 'post'