Chromium now follows Firefox's policy on the download attribute.
This commit is contained in:
parent
ce6e6b52f5
commit
45d4d2241b
@ -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'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user