开发者

How to catch "History.Back" event in javascript?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜