Back Button in my Web application

Back Button in my Web application

BY 07 Oct 2015 Web Application Development

Hello,

I am developping a simple inscription form, and a function login() which will be invoked when the user hit the “ok” button:

===========================

 

 <script type=”text/javascript”>
        function login(){
            
            sessionStorage.setItem(“nomp”, document.getElementById(“tfnom”).value);
            
            window.location.href=”page2.html”;
            
        }
    </script>

 

 

==========================

 

The problem is that: First, the  window.location.href doesn’t work, but if I changed it to window.open(“page2.html”) it works and my page2.html is shown… Second, when I would like to return to my index.html page from page2.html: the back button doesn’t work.

 

I’ve read that it is due that I am opening the page2.html into a new window, all right, but what should I do in that case?

Thank you

Written by