I have a jsp page -- let's call it index.jsp. The user clicks on a link in this page -- let's call the link section1.jsp. Inside section1.jsp, there exists a form. When the user submits the form, it opens up another page called portal.aspx.
When the user clicks the back button in the browser, I want the page to go back to index.jsp.
My idea is this: Create a session from request.getHeader('referer') to record the index.jsp page. This will get set when the user enters section1.jsp. The idea is when the user is in portal.aspx and clicks the back button, I want it to check the session variable and, if it is set, redirect to the referer URL. Then I tried it and it didn't work.
Is there some way to accomplish what I just described, without the browser recording secton1.jsp in its history, such that the user will go to index.jsp from portal.aspx, when said user clicks the browser's back button? Please understand I'm looking for a server-side solution and I must use a form to open the portal.
Thank you for any help.
If you are going pure server side, there is no solution. You may as an alternative use a cookie to store the return URL, this will ensure it doesn't get lost should your page flow change in the future. only issue, now your two back ends need to shate the same domain.
I would personally go with a little of frontend help, these are really API JS api to handle page history.