is it posible 开发者_StackOverflow社区to catch "History.Back" event in javascript? İ want to catch history.back() event and logout user.
P.s : There is some code about disabling history.back(). But is not useful for me.
<script type = "text/javascript" >
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
then set onunload
event
<body onunload="disableBackButton()">
You can catch history back using "window.onpopstate" event. But AFAIK it is only available in HTML5.
http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#event-definitions-0
精彩评论