Eleanor Batchelder
Eleanor Batchelder

Reputation: 11

HREF is generating weird link

I defined a name tag on the page http://olderwomensnetwork.org/advocacy:

<a name="note"></a>

Then I referenced it (on the same page) like this:

<a href="http://olderwomensnetwork.org/advocacy#note">go to Note</a>

And it reported a not-found error for http://olderwomensnetwork.org/http:/olderwomensnetwork.org/advocacy#note What am I doing wrong?

Upvotes: 1

Views: 194

Answers (1)

Anirudh Ramanathan
Anirudh Ramanathan

Reputation: 46728

If you notice the error message you got, it is http://olderwomensnetwork.org/http:/olderwomensnetwork.org/advocacy#note

                                 ^

You have missed a / in your link. That makes the browser think it is a relative URL and hence, the 404.

Good Practice: As you are using the note anchor for navigation within the page, specify the URL as <a href="#note"..></a>. It isn't necessary to specify the entire URL.

W3C Reference

Links within a document

Upvotes: 5

Related Questions