I tried [here](adevertising.pdf) to link a pdf which is in the same folder of my markdown file, but when I click on the link I end up with a 404 page not found error.
How can I create a link that will redirect the user to a pdf storred in the same folder ?
The solution is to add a /:
[here](/adevertising.pdf)
Related
If I have a site that has a directory listing, such as this one, can I modify it to open in new tabs by default when someone clicks on a file or folder? Does this relate to the .htaccess file?
Take this link for example. OJI/
Add attribute target="_blank", and you'll get OJI/. Now, click the modified link will do.
So I found out that first you need to specify a header file in .htaccess:
HeaderName header.html
Then you need to place a "header.html" in the directory, and put this line in the file:
<base target="_blank">
Now every file in that directory will open in a new tab
When I reference a .pdf in my webpage, the file doesn't open when I click on the link. I referenced the .pdf with the full path and the file is in the www folder.
When I hover over the link online, I can see that the link is to my .pdf on file but it doesn't open.
What am I doing wrong?
Thanks (HTML newbie)
Edit 1 - reference:
Filename
Edit 2:
I tried the local links extension and it still isn't opening. I also tried <a href="http://www.example.com/myfile.pdf"> and I get a 403 Forbidden error.
Modern browsers block links to file:// URLs from pages that aren't themselves on a file:// URL, and in the same directory tree.
This is a security feature. There are workarounds that you can install locally so it works on one specific computer. See this Mozillazine article.
Sorry - I don't have the rep to comment. But it looks like your ref structure could be wrong.
Try something like:
<a href="http://www.example.com/myfile.pdf">
UPDATE: Hmmm?
Have you tried just:
<a href="myfile.pdf">
Also, I found this which (while not directly relevant) has some discussions and links that may assist: How to set height on PDF file when linked to from HTML?
^^ Ignore that - it really is more related to how the pdf opens.
FURTHER:
I am assuming the pdf file name has no spaces in it. I also assume you have a local pdf viewer.
So I had a look at a random website which had a pdf link as an example. When clicked, it opened the pdf in a new tab. I am on chrome.
You may be able to use that to figure out what is wrong.
Here is the page: http://www.staff.uwa.edu.au/procedures/communications/media/uwanews
Looking at the pdf for the first listed file, this was their link:
Issue-10-December-2014 [PDF File, 2.0 MB]
It looks like path should be enough, but you might want to add the target="_blank" to open in a new tab.
Maybe also see this, which shows that users set how a pdf is opened - perhaps the settings on your end need to be set up: How to open link to pdf file in new tab using html
Anyway, I wish you the best. Post your answer when figure it all out.
I have a website and I've been searching a lot for this question and can't find anything yet.
Anyone knows how to make links take you to another folder and show the html page without page in URL? Example:
I have a html page called service.html and its on folder /service. I want a link to take me there without displaying in the URL my html file like:
click me
And it takes you to the html file and shows your content without displaying the html name in the URL. just www.example/service/ :D
Calling the file index.html instead of service.html should work, if the website is currently hosted.
You can use the method #tasteslikejava mentioned, or you can create a .htaccess in the services directory and put in the following information:
DirectoryIndex service.html
Is that what you want?
link
How to link html pages in same or different folders?
I just created a basic html file and want to upload that file to my website.
So what I've done is, went to cpanel->file manager->/htdocs and uploaded the file(sandy.html).
But the problem is it's not executing on my home page( i.e. sandeep.0fees.net). It's just showing the file that I uploaded.
I think you'll understand better when you see my website.
Where I'm going wrong? What should I do to make that file to run on sandeep.0fees.net instead of sandeep.0fees.net/sandy.html?
Rename your file to index.html
Or call it directly http://sandeep.0fees.net/sandy.html
Try renaming it index.html. There is a setting called a default document and that is the file that is loaded when you end the url without a filename.
If you want it to be the default landing page, call it index.html instead.
You can also add this line to the .htaccess file, in the public_html folder:
DirectoryIndex sandy.html index.php index.html
If it doesn't exist, create it! :)
Say I have a link like this on public_html/index.html:
Link to picture
Since the "link to picture" has its own folder and uses index.html, normally that extension would be hidden if I type in "www.mywebsite.com/pictures". But if I first go to "www.mywebsite.com", then click that link, it would display in the address bar as "www.mywebsite.com/pictures/index.html". How would I hide the "index.html" in links? I've tried this but it doesn't work:
Link to picture <---this simply opens the file directory
Thanks.
Add the following to your httpd.conf file:
DirectoryIndex index.html
And by default if you don't pass in a filename index.html gets rendered instead of the directory content