Sunday, 30 September 2012

Web Page History Using Java Script

history Object

Contains information about the URLs visited by the client.
For security reasons, the history object does not expose the actual URLs in the browser history. It does allow navigation through the browser history by exposing the back, forward, and go methods. A particular document in the browser history can be identified as an index relative to the current page. For example, specifying -1 as a parameter for the go method is the equivalent of clicking the Back button.

 <a href='javascript:history.go(-1)'>Back to the previous page</a>

Jump one page back according to history  

<script language=javascript>
        function goForward()
        {
            history.go(1)
        }
    </script>

<input id="Button1" type="button" value="Next" onclick="goForward()" />

Act as forward button