The way I did this was to set the value of the true variable for every click on the actual site. The statechange event will then check this variable. If true, they used the link on the site. If this was incorrect, they pressed the browser button back.
For instance:
var clicked = false;
$(document).on('click','a',function(){
clicked = true;
});
History.Adapter.bind (window, 'statechange', function () {
if( clicked ){
}else{
}
clicked = false;
});
Hope that helps :)
will source
share