gpt-4o-mini-2024-07-18· OpenAI
WildChat-4.8M (AI2)
How to make a link to download file after click on text in HTML? It schould be a .docx…
- User
How to make a link to download file after click on text in HTML? It schould be a .docx file
- Assistant
To create a link in HTML that allows users to download a
.docxfile when they click on some text, you can use the<a>tag with thehrefattribute pointing to the file's URL and thedownloadattribute to signify that it should be downloaded rather than navigated to. Here's an example:html<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Download .docx File</title> </head> <body> <a href="your-file.docx" download="your-file.docx">Click here to download the document</a> </body> </html>