Returning back to an HTML page - html

I have two html files called home.html and options.html. In the options.html, after I clicked the submit button, I am now in the cgi-bin directory of my webserver. What should be the format of my anchor tag so I can go back to the home.html page?
This is the code:
<a href='localhost/cgi-bin'>GO BACK</a>
The error I encounter is:
The requested URL /cgi-bin/localhost/home.html was not found on this server.

Not sure I have understood your issue, but this probably could work:
<a href='/home.html'>GO BACK</a>

you can use:
<a href='javascript:history.back(-1)'>GO BACK</a>

if both pages are in same directory you can do something like this
GO BACK
else give absolute path
<a href="http://webserver/cgi-bin/home.html" >GO BACK</a>
post complete directory structure of both files so that we can find a relative path.

I found the answer to be:
GO BACK

use
<a href='localhost/cgi-bin/home.html'>GO BACK</a>

Related

Not Downloading Files in HTML

I am trying to create a download link to a file I've created but it is not working. I've tried it without the <img> and without the download specification but nothing seems to work!
<a href="Downloadable File.txt" download="file">
<img src="downloadbutton.png">
</a>
All it does is redirect me to a page without the file downloading like it's supposed to, how do I fix this?
Try this and make sure that your file exists on the server or at least at the right path.
<a href="path/to/your/download/file" download="filename">
<img src="downloadbutton.png">
</a>
It is not download="file".
It should be download only.
And please check your href. It should be some path to your file.
<a href="path/to/your/file.txt" download>
<img src="downloadbutton.png">
</a>

href link working for one item but not for another

I have an index.html that includes:
<li>
<a href="imprint.html#imprint-link">
<div class="main-menu-title">IMPRINT</div>
</a>
</li>
When I click on this item another html file (imprint.html) is loaded, but when I click on Home, which includes the following code to go back to index.html, it doesn't work!
<a href="#index-link">
<div class="main-menu-title">HOME</div>
</a>
What is wrong here?
Update 1: When hovering the mouse over the link I get:
try using this code :
<a href="index.html">
<div class="main-menu-title">HOME</div>
</a>
inplace of :
<a href="#index-link">
<div class="main-menu-title">HOME</div>
</a>
To answer your original question.
What's wrong here?
As a couple kind folks already commented and one person already provided a nice solution, clicking on your original link
href="#index-link"
while you are on the imprint.html page will not take you to your index.html page. Why? Because
<a href="#index-link">
<div class="main-menu-title">HOME</div>
</a>
is saying, "Take me to an element on the current page (imprint.html) that has an ID of 'index-link'. If there is no element with and ID set to index-link, on the imprint.html page, nothing will happen. And, you will stay on the current page because you didn't specify an URL outside of the current page, which is still imprint.html.
So, with that current setup, you will not get to see index.html.

Go to external url?

Okay, this is so simple yet I don't know how to do it.
I use vhost that makes localhost/wamp/www/blog/public become blog.dev
sample:
Stack Overflow
expected result: go to stackoverflow.com
what it actually does: go to blog.dev/stackoverflow.com
So, how should I do?
First of all, if you use a relative URL like above, your browser will assime that it's a URL relative to the URL you're currently browsing. That's why
<a href="stackoverflow.com">
links to blog.dev/stackoverflow.com
Replace
<a href="stackoverflow.com">
with the absolute URL
<a href="http://stackoverflow.com">
to get what you need.
Secondly, you could add target attribute to your URL if you want to open the link in a new window/tab:
<a href="http://stackoverflow.com" target="_blank">

Hyperlinking a page to a local page (in files) HTML

Im trying to set up a hyperlink from my current page to another page via my files, however it doesn't work...
My code:
<ahref="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html"><input type="image" id="Languages" position:absolute style="height:px; width:px;" src="./CSImages/About.PNG">
<!-- Thats in context, the HREF is following-->
<ahref="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
Once i click the hyperlink it comes up with an error that repeats the directory:
file:///C:/Users/ashsa_000/Desktop/Html/6%20weeks%20project/file///C:/Users/ashsa_000/Desktop/Html/6%20weeks%20project/Index/Languages.html
How can i fix this?
First of all, the tag in conjunction with the href attribute work as follows <a href="path/to/file.html">. Noticed the difference (space)?
Secondly, if the file is in the same folder, all you need to do is reference the file that you want to link starting from that path and upwards.
You were on the right track, your href would become: {}
Consider naming files with lowercase letters only. Its not necessary, but a well accepted practice!
The <a> must have a space between the a and href: <a href="">
When you use the href attribute, the path will be based on which file you put the <a> in, e.g. if you put the <a> in the index.html, and you want to reference to languages.html, first make sure that the languages.html is in the same folder as index.html (easier) and then just reference to it with:
<a href="languages.html">
Also, why are you using an input tag? Just use an img tag. I'll fix your code:
<a href="languages.html">
<img id="Languages" style="position: absolute; height:_px; width:_px;" src="CSImages/About.PNG">
</a>
This only works if the folder CSImages is in the same directory as index.html If not, just change the path accordingly.
Hope this helps!
<a href="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
<input type="image" id="Languages" position:absolute style="height:px; width:px;" src="./CSImages/About.PNG">
</a>
As mentioned in comments, you should put a space between a and href. Additionally, you should close the a tag.
Why are you using an input element for showing an image? Maybe you are better off with an actual image tag:
<a href="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
<img id="Languages" style="position:absolute; height:[insert missing value]px; width:[insert missing value]px;" src="./CSImages/About.PNG">
</a>
You may also have a look at this SO question for more reference on links to local files: How can I create a link to a local file on a locally-run web page?
Add the space in the a href, put the image in an img tag, and don't include height and width unless you are going to include a value. Also position:absolute has to go in a style tag. Finally, close your a tag.
<a href="file:///C:/Users/ashsa_000/Desktop/Html/6weeksproject/Index/Languages.html">
<img src="./CSImages/About.PNG" style="position:absolute">
</a>

Wordpress changes URL?

I have an image which serves as an a href, the following a href doesn't work:
<div id="buttonNext">
<a href="1-5/redrum-10">
<img id="buttonNextImg" src="../../resources/img/buttonImg/next.png"/></a>
</div>
Me clicking on the link results in me being redirected to this website:
http://localhost/redrumwordpress/wordpress/redrum-10/
which also exists, but it doesn't link me to the correct website, the following code does work and links to the correct website:
<div id="buttonNextBottom">
<a href="1-5/redrum-5/">
<img id="buttonNextImgBottom" src="../../resources/img/buttonImg/next.png"/></a>
</div>
Which re-directs me to the correct page:
http://localhost/redrumwordpress/wordpress/1-5/redrum-4/
I've checked if I missed something like a / or ../ maybe it was in the wrong folder.
I've checked for the file not being there, but it is and it isn't corrupt.
Could anyone help me with why WordPress won't link to the correct website, when I use this website outside of wordpress it works just fine.
Can't you use:
<?php bloginfo('url'); ?>
Which will get your site address, then add the link path relative to this?