How to Specify a Suggested Filename When Using data: URI
Question:
When a data: URI is clicked, the browser prompts the user to download a file with the data encoded in base64. Is there a way to pre-specify a default filename for the downloaded file?
Answer:
Using the download Attribute:
Use the download attribute in the tag:
<a download='FileName' href='data:application/octet-stream;base64,SGVsbG8='>
Availability:
Note:
The download attribute is not supported in IE11.
Additional Information:
The above is the detailed content of How to Pre-specify a Filename for a data: URI Download?. For more information, please follow other related articles on the PHP Chinese website!