Go Back to previous page code isn't working


#1

I'm using this code to allow page visitors to return to the previous page, without succes.
Any help will be appreciated.

<script>
function goBack() {
    window.history.back();
}
</script>
</head>

........

<body>
.....

<button onclick="goBack()"> Return To Previous Page</button>

.....

#2

Does this help?


#3

Thanks, but after trying those suggestions, still no success.
Any additional help is appreciated


#4

It works for me :slight_smile:
https://jsfiddle.net/srj3bupx/


#5

Try temporarily changing the function to this and see what's in the console.

function goBack() {
//    window.history.back(); 
  console.log(window.history.length); 
}

More than 1 ?


closed #6

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.