Search code examples
htmldirectoryanchortraversal

Anchor tag to root directory


With my limited tech vocab I can't find a related question / answer to this question.

I'm working on a project that has some back buttons that need to traverse up 2–3 levels in my directory (which happens to be back to my root directory / home page). I have been using this <a href="../../"></a> or <a href="../../../"></a> depending on how many folders I needed to jump up.

In passing it was just suggested to me that I use <a href="/"></a> as this will send me straight back to my root directory / home page.

My question is are there any drawbacks to using this method?

I can see the benefits from a performance point of view, even if it is only a couple less characters, every little bit helps.

Thanks all who are prepared to clarify for me.


Solution

  • After some discussion I have confirmed there are no drawbacks with this method.

    It's just an effective way of going straight back to your root folder should you need to.