You’re probably here because you need a back button for your website and
history.back(); just isn’t enough.
But why use a button when you can use your browsers back button too. Well that’s easy. From A/B testing we noticed that every user has it’s own way to navigate your website. So it isn’t wrong to help them reach there goal.
The script below is still very simple but a bit more advanced then only a back button.
The button will check the URL and will do 2 things.
1: If your previous URL is the same as the base URL of your site, it will use the
2: If not, for example your visitor came from different website like Google, it will set a fixed URL for example
base URL + /projects.
This is a fallback for who ever uses the back button but came from different site. That way they wont go back to the previous website but go to your overview page.