开发者

Back Button With Javascript

开发者 https://www.devze.com 2023-03-13 19:36 出处:网络
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

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

精彩评论

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