Is there a way to suggest a filename with a data URI?
I am using the data attribute to simulate a file download from client-side JavaScript. Here's my source code:
var data = "data:application/text,anything is here";
window.location.href = data;
This works great and simulates file upload. Is there a way to specify the file name, as part of the data URI, or using another tool available in the browser?
I know the download
tags attribute <a>
, but I was wondering if there are any options other than the default, which should use the value data
as the recommended filename.
source to share
I don't believe there is a way to do it when you redirect the browser this way.
If you provided download from a link, you could use the attribute download
to suggest a filename. Not all browsers support the attributedownload
at this time.
source to share