I am making a website on my localhost and I have a download pdf button in the footer. When I try to download it it pops up in Chrome downloads but itsays it failed to download. When i go to the URL of the pdf it says CANNOT GET /images/.pdf so I think its a localhost problem? If i go see the url of an image in the same folder it works but the pdf doesnt work.
This is my code in JADE
li.
<a href='http://www.bpost.be/site/nl/disclaimer.html'>Disclaimer</a>
|
<a href='/Reglement-SurpriseWebshop-NL.pdf' download>Wedstrijdreglement</a>
<a href="./directory/yourfile.pdf" download>Download the pdf</a>
Try this
Related
im using this command to download a file when I click on the download buttonenter code here
<a href="text.txt" download>download </a>
its working perfectly but when I go to for example website/text.txt it does not download automatically how can I make it do so?
On my site hosted by GitHub.io, I have a download button like the following:
<a href="link to the file" download>Download</a>
However, when I click on it, it redirects me to the page where the file is located. How do I enable download rather than redirecting?
The download attribute only works for same-origin URLs. So if the href is not the same origin as the site, it won't work.
In other words, you can only download files that belongs to that website.
Here's a more detailed explanation of the same.
Trying to have a link open up to a PDF. I have the href="filename.pdf" - the pdf file is in the same folder as the html file. When I click on the link it opens to a new page (I have it set to open a new page) which says "Cannot GET /filename.pdf". I open the console and it says "Failed to load resource: the server responded with a status of 404 (Not Found)".
I found a solution that works but I don't understand why:
This doesn't work:
<a target="_blank" class="cta-btn cta-btn--resume" href="connerschiller.pdf">View Resume</a>
But this does work:
<a target="_blank" class="cta-btn cta-btn--resume" href="../src/connerschiller.pdf">View Resume</a>
The html file is in the src folder as well.
Ok so the fix I listed above is working when I run it locally, but when I try to open the PDF link on the deployed site on netlify it says "Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site."
If the file is in the same directory you need to use as follows:
My pdf
the ./ is to especify the same directory
I am trying to make a downloadable file on my web page with this
<a href="http://ir-devtestsvr/4ms/media/e54d5f61-7375-405a-a6af-bb37f2447991.PNG" download>View file here</a>
but when I click the element, it just opens a page that views the file but not download the link. How can I do that when I clicked the element it will download the file.
The download attribute only works for same-origin URLs. Is the file you want to make downloadable hosted on the same protocol, port, and host as the page? Even something as small as the page or file being served as http and the opposite being served as https will break it. See more at: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
I used the code:
<a download href="https://web.stanford.edu/group/csp/cs21/htmlcheatsheet.pdf"> Download cheetsheat</a>
but i wasn't able to make the link download the PDF. It opens the PDF instead.
The attribute is "download" but it is not working
Set the download attribute to the filename:
<a download="htmlcheatsheet.pdf" href="https://web.stanford.edu/group/csp/cs21/htmlcheatsheet.pdf"> Download cheetsheat</a>