简体   繁体   中英

I need to reload the previous page to 'another URL' when I click on back button in browser

Suppose now I'm in google.com the I typed facebook.com in same page then from this page I clicked browser back button, then I need to load gmail.com instead of google.com . I need JavaScript/JQuery code to this.

Anyone please help regarding this. very much Thanks in advance....<3

I got answer.

<script type="text/javascript">
    $(document).ready(function() {
        if(performance.navigation.type == 2){
 window.location.replace("www.google.com");
}

 </script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM