To link a page to itself (e.g. http://example.com/folder/ThisPage.html), we can simply create a href as such:
ThisPage.html:
<a href="ThisPage.html">Link</a>
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 <a href="ThatPage.html">Link</a>
.
I'm looking for an alternative without that disadvantage. I've tried:
<a href="?">Link</a>
Doesn't work as <a href="ThisPage.html">Link</a>
does, because it appends a "blank query part" (question mark) to the URL.
<a href="">Link</a>
Doesn't work as <a href="ThisPage.html">Link</a>
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 <a href="?">Link</a>
. Nobody cares about the question mark appended to the URL. It does the requirement and that is what counts right?
If you want it to go nowhere, you can use
<a href="javascript:;">link</a>
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With