I want to redirect users to the previous page whenever they visit a specific page
Let's say: page123.php
I have the following code on that page that redirect users to the previous page but on click:
<script language="javascript">
$(document).ready(function() {
$('.goback').click(function() {
history.go(-1);
});
});
</script>
I want to automate the process so whenever they visit that page (page123.php) they redirected back to the previous one. I'd greatly appreciate it if anyone could help me in achieving this. Thank you.
Note: I don't want to use htaccess redirection.
You can add this tag to your html: