I am working on an application in which the user deals with tickets. On each ticket the user can click a "Go Back" button, and is sent to the previous page.
The function is using window.history.back() and verifies before that the history is not empty! But, there are two issues to this method :
1. when the user wants to access the ticket via the URL, he firsts has to sign in, then if he clicks on the "Go back" button, he is redirected to the login page.
2. when the user comes from an other site, the "Go back" button makes him return to the previous site.
I read a lot about the history things and so, but I did not find any solution to get the previous URL as a string without going to this. I also already tried the referrer things without success.
Thank you for your answer!