Let's say you have a website / app where there are user pages, and on the user page there are additional links for things like that user's awards or posts. Something like this:

enter image description here

The issue I'm having is that currently I don't have back buttons, so if someone is linked directly to the /users/5/awards page, there is no way for someone to go to /users/5 and see that person's profile, outside of manually editing the URL.

Okay, simple enough, add a "Back to profile" link on the ./awards and ./posts route, but the problem with that is sometimes users will be directly linked to a post and then click a user to go to their profile, and then click to see their awards. Then if they click the "Back to profile" button, and then use their browser back button, it will take them back to the person's awards instead of going back to the post.

And I can't have a "Back" button on the profile page, because someone could have came from a post, the users page, or something else.

I was thinking about manually saving the routing history of each user, and then having Back buttons sometimes execute history.go(-1) if the previous route is the same as the href of the link, and otherwise being a direct link, but I'm not sure if that is confusing.

What is a good way to handle this? If someone is directly linked to someone's awards, I want a way for that person to be able to go to their profile, but the existence of these buttons interfere with existing routing, because some routes (like the user page), have multiple ways of getting to them, so they can't have a static "Go Back" link.


Your Answer

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