<a> link puts page name at end of url - html

Sorry if the title is confusing, I wasn't exactly sure how to word this.
Basically what I want to do is make a link, simple enough. The page is tylerofcinema.github.io and if I make a link to say, google.com the url that I get is tylerofcinema.github.io/google.com.
Code is in a repo here, let me know if there is any clarification needed.
Thanks, Diego

You did not include the protocol of the url, causing the href to think it needs to open a page in the same directory.
Try adding http:// (or https://) to your href and it will open the specified url.
<a target="_blank" href="https://tylerofcinema.github.io/r/twitter"><button class="homesmb">Twitter</button></a>

should be a simple syntax error.
My suggestion would be to change the url to the full address like http://www.google.com so that the browser understands you mean the actual google server and not something else. give it a try

just add // before the start of the link, it should work

Related

Extracted URL not redirecting

I am looking at the following site: https://www.lg.com/us/press-release.
I need to get a link to go directly to the computers tab, and it needs to be a url.
I extracted and tried: https://www.lg.com/us/press-release#press-list5 however this still redirects.
Can someone tell me what the URL is to go directly to the computer tab please?
Thanks
I don't think a URL is going to work. I believe there's some Javascript at work here.
Why?
Before/Unclicked:
Computers
After/Clicked:
Computers
So once it's clicked, the list item has the active class added and the aria-selected attribute set to true. So a URL with a bookmark doesn't look like it'll work.

HTML Link doesn't work properly sometimes

I am using a local server for my applications and sometimes when I created a button or a link to another page in a new tab, it turns out to not working properly. It's not always like this, but sometimes, might sound silly. I give example below.
Let's say my application is **programmingworld** which exists in www folder, then in index.html file, I create a link for a button like this
Download Codes</div>
When I open it in a browser and click the button, sometimes it goes to http://localhost/programmingworld/www.google.co.uk where nothing is displayed on the page. It supposed to be www.google.co.uk in the new tab where I can see the google homepage.
Can you please tell me why?
You should write:
Download Codes</div>
If you didn't write http:// at the the beginning of the hyperlink, it will be search you your local directories or files.
To make sure that the link goes to where you intend and not where it goes try adding // or http://.
Example:
Google
or
Google
With // it will try http and https.
You're missing https:// before www.google.co.uk
So you're markup should look like this:
<a href="https://www.google.co.uk">
<div class="button" id="button=popup">Download Codes</div>
</a>
you can also do it like this (no https):
<a href="//google.co.uk">
<div class="button" id="button=popup">Download Codes</div>
</a>
Because you haven't included the protocol in your URL. it must start with either http:// or https://
Also, remove the div from inside the anchor tag.
Your question suggests that you need to do a little bit more testing on basic html.
I would most definitely suggest using https://
I've had similar problems such as that, and in order to fix them try adding https.

Anchor with hash in href attribute is opening a new page

I have never seen this behavior. I have a simple hash link on a website. The link looks like this:
<a href='#view_123'>Click</a>
On my test server, when I click, it simply changes the url to
http://www.myserver.com/mypage.aspx#view_123
And the page does not redirect anywhere. However, when I push this same link to my live server, it causes the browser to redirect to:
http://www.myserver.com/www.myserver.com#view_123
This makes no sense to me. The only way around this is to put the full url of the page in the href with the hash appended to the end, but this is causing me other problems and is not what I want to do.
The only clue I've come across is the MIME type, but I'm pretty sure mine is correct as "text/html".
There is no javascript causing this. I can hover over the link, and the url hint in Chrome shows the incorrect url.
Have you tried changing the target tag?
<a href='#view_123' target='_self'>Click</a>
or
<a href='#view_123' target='_top'>Click</a>

A link that doesn't work, even if the source is ok

I don't understand what is going on!
I have this page on my website with an url that point to the personal website of the user:
http://www.recettesmaison.ca/Profile/Details/Sandra
The url is ok in the source:
<h5>Site web personnel</h5>
www.vitaminesetmarmitons.com
But if you try to click on it in the page itself, it goes to:
http://www.recettesmaison.ca/Profile/Details/www.vitaminesetmarmitons.com
If the user update his website and put http:// before the www, then the link works ok...
What is going on?
You're missing your protocol:
www.vitaminesetmarmitons.com
should be
www.vitaminesetmarmitons.com
Put http:// in front of the URL. Otherwise the browser will interpret it as a relative link, not an absolute one.
www.vitaminesetmarmitons.com
^^^^^^^
you must add http:// in the beginning of link address
without http (Protocol) the link supposed as folder

How to link a webpage to itself without first knowing its name?

To link a page to itself (e.g. http://example.com/folder/ThisPage.html), we can simply create a href as such:
ThisPage.html:
Link
This works, but has the disadvantage of needing to be updated when the file name changes. For example, if the file name changes to ThatPage.html, our href needs to change accordingly to Link.
I'm looking for an alternative without that disadvantage. I've tried:
Link
Doesn't work as Link does, because it appends a "blank query part" (question mark) to the URL.
Link
Doesn't work as Link does, on some browsers (e.g. Opera).
How do we link a page to itself, without having to update the relevant portion when the name of the page changes?
Note: JavaScript not allowed.
Just use Link. Nobody cares about the question mark appended to the URL. It does the requirement and that is what counts right?
It's very simple, just leave the href="" blank. So that's how:
Click me to refresh page
But this is not necessarily a good idea, because the cache may not be cleared, and whatever you need it for, if the page has changed in the meantime the change may not appear despite the reload. Probably a better idea is the javascript code location.reload(); to take. But there are enough explanations on other sites, which is why I won't explain it here. You can of course also for example take a question mark (?), but this is unnecessary, actually not intended for it and can cause problems depending on the program.
Here is a short list of common hyperlinks:
Points to the root page
Link
Points to a file relative to the root page
Link
Points to a file relative to the current file
Link
Points to a file in the previous folder
Link
Points to a file in the second previous folder
Link
Points to a file in a folder below
Link
Points to the current file
Link
Points to a page with a different host but the same protocol
Link
I hope that my answer will help some people, because I found it via a search engine and saw that there is no correct answer. And it's my first answer here 😅
If you want it to go nowhere, you can use
link
But if you want it to reload the page, you'll have to go with JavaScript.
If you want to reload the page you could use the Meta refresh tag
http://www.w3.org/TR/WCAG20-TECHS/H76.html
If you want to reload the page, you really should take a look into javascript. It is the best way to do it.
Just do this:
This Very Site
Source: I saw this in the source code of Matthew Alger's website. Check it out for yourself!
Why not try ?
I looked some things up, and as it turns out, ./ refers to current directory.
You can just make a link to the same page.
Here ya go. Hope this is what you are looking for
Link