Anchor tag download file instead of showing file






















If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.

Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid. Related Questions. Why anchor tags not working after adding CSS file in head? Angularjs- download pdf file using anchor tag in angularjs. Routing use in anchor tag. Download File Path from system. How to download image file from cross domain. How to find particular URL from within anchor tag using javascript.

How to save pdf to file server location? Download Files Using File Paths. Layout: fixed fluid. Web02 2. Strip HTML. Encode HTML. Ask Question Share Tweet. Download Source Code View Demo. Ranarivelo Said Trivanho Said December 25, at AM. Dilip Said Amit Shee Said Great, This is really helpful for download file using CodeIgniter.

If for whatever reason, you cannot add the download attribute in the case that you cannot directly edit the HTML of your web page , you can optionally compress the file using zip, and instruct the user to download the zip file. You can alternatively explain to the user that they should right click on the link and select download. If you have no other alternatives to force the file to download, you can host it on a file hosting service such as Google Docs.

The most common file types that are affected by this behavior are PDF files and images. The code below will tell the browser to prompt the user to save the file. This link does not have the download attribute. This link has the download attribute.



0コメント

  • 1000 / 1000