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
Related
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.
I'm creating a personal website for myself so I have my directory uploaded to github. The website is linked to githubusername.github.io and it works fine for me when I open it up but when I click on a post on that website, I get a "404 File not found" error from github.
The post has a link tag to minesweeper.html located in index.html.
<a href="minesweeper.html"><img src="assets/img/Minesweeperimg.png" alt="" class="img-fluid">
Here's a picture of my file structure.1
Why am I getting the error and how do I fix it? When I run the html locally, it runs fine.
In order to call a file from your published Github Pages repo, the URL should be in this format:
https://<user>.github.io/<repository>/assets/README.md
So if your username is "gene", your file should be available on the URL:
https://gene.github.io/gene.github.io/minesweeper.html
I am trying to allow my webpage to host pdf to be downloaded from my server. When you click the link, it downloads a file, but the file it downloads does not open. In Adobe it says "it is either not a supported file type or the file has been damaged". In chrome it says the file failed to load.
I know the file is not corrupted because I can open the file just fine in WINSCP (FTP client). Online the code seems very simple yet it is not working for me.
<form class="form-horizontal" style="margin-top:15px;">
<div class="form-group">
<a href ="/documents/Cow.pdf" download>Download</a>
</div>
</form>
The cow.pdf is stored in a folder named documents. The document folder is saved in a folder named template, where all my other HTML pages are saved.
Any help is appreciated. Thank you
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
Strange... When i create an HREF to a .doc, the browser behaves correctly and onclick allows the user to download the file.
If I have an HREF to a .docx, it doesn't prompt to the user to download the file but shows a "The page cannot be found" error page at the url of the file.
Any ideas?
Ok, just figured it out... It's an IIS MIME type header setting that needs to be added:
.doc
application/msword
Not to overlook the most obvious answer, but the file does exist, and the link is correct?