webkit / Chrome history.back(-1) onclick vs href

后端 未结 3 505
故里飘歌
故里飘歌 2021-01-04 01:45

Everybody knows that but I\'ll repeat the problem:

Back

Will not work in WebKit ba

相关标签:
3条回答
  • 2021-01-04 01:57

    It works even history.go(-1) also...

    For Chrome, IE, Mozilla i tested, works fine. use below code:

    <a href="#" onclick="history.go(-1);return false;" style="text-decoration:underline;">Back</a>
    
    0 讨论(0)
  • 2021-01-04 02:01

    Finally working solution, tested in IE, FF, Safari, Chrome, Opera, Maxthon:

    <a href="#" onclick="window.history.back();return false;">Back</a>
    

    Don't forget semicolon after return false;

    0 讨论(0)
  • 2021-01-04 02:05

    This is the only thing that works on all current browsers:

    <script>
    function goBack() {
        history.go(-1);
    }
    </script>
    <a onclick="goBack()">Back</a>
    
    0 讨论(0)
提交回复
热议问题