Home >Web Front-end >JS Tutorial >Can I Suggest a Filename for Data: URI Downloads?
specifying suggested filenames with data: URI
When using data: URI, the browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a JavaScript solution?
Answer
Yes, you can use the download attribute to suggest a filename when using data: URI.
<a download='FileName' href='your_url'>
The download attribute is supported by Chrome, Firefox, Edge, Opera, desktop Safari 10 , iOS Safari 13 , but not IE11.
The above is the detailed content of Can I Suggest a Filename for Data: URI Downloads?. For more information, please follow other related articles on the PHP Chinese website!