开发者

Back Button With Javascript

when i hit back button in browser it should navigate to desired location,

but the code written below works for all the buttons including the 'form' buttons

window.onbeforeunload = function () {
       location.replace('http://www.google.com');
       return "Th开发者_StackOverflow社区is session is expired and the history altered.";
    }

how i can restrict this functionalty to browsers back button alone

thanks


Tampering with history is not allowed in the browsers due to privacy & security reasons. Due to this, you won't be able to do this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜