Using JavaScript you can go back or forward in the browser's navigation history.

Code Snippet

function GoHistory(number_of_page)  
{ 
     history.go(number_of_page);  
}

Sample Usage

//To go back     
<a href="javascript: GoHistory(-1);">Go back one page</a>  
<a href="javascript: GoHistory(-2);">Go back two page</a>    

//To go forward    
<a href="javascript: GoHistory(1);">Go forward one page</a>  
<a href="javascript: GoHistory(2);">Go forward two page</a>

Note

If you want to go previous pages in history, pass (-1 , -2 ,-3 etc ) If you want to go next pages in history, pass ( 1, 2, 3 etc)




author's photo

Author : Blue Cloud

Just a normal software developer who love to write code. Developing professional software since 1999. After working in the software industry for many years, I've started my own website to share knowledges and experiences.

COMMENTS
blog comments powered by Disqus