With onclick="history.go(-1);return false;" user can navigate to back pages. But if I want to put a confirm method before it takes user to the back. How would I do that?
I think it can be achieved by doing something like below but I am not sure how to redirect user to back page?
$('.clickme').click(function() {
if(confirm("Are you sure you want to navigate away from this page?"))
{
//window.close();
// how to redirect to history.go(-1) ??
}
return false;
});
UPDATE
Also is there any way I can check if history has some values in it or is empty? So that I can alert user if is empty?