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

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


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;


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>


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

<script>function goBack() {    history.go(-1);}</script><a onclick="goBack()">Back</a>