Would it be a good idea to not redirect the user if the clicked anchor tag address is the same as the current address of the user?

e.g. If user is currently at //example.com/home and he clicks a link to //example.com/home do not redirect the user.

What are the Pros and Cons for good user experience. Thanks


A few reasons why you should load the page (redirect) if a user clicks an anchor to the currently viewed page:

  1. A user might be using this functionality to reload the page (instead of pressing F5/reload)
  2. A user might think the link is broken if nothing happens when they click it.

So the answer is, it's not a good idea to not redirect - i.e. don't remove the default behaviour of clicking the link.

If there is a reason that you don't want to reload the same page then remove the link completely from the page or disable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.