I need to find whether the user clicking the browser back button or Refresh button.
I need to redirect the page to Error page when he clicks the back or refresh button.
This simply detects if the user lands on your page using the back/forward buttons... the only problem is with IE8 and lower, the browser version cannot handle this.
if(performance.navigation.type == 2) { //Do your code here }