Script to go back to the previous page updated?

2

Well, I wanted something that would make it that when someone clicked to go to a page it was redirected to the previous page .. But the page refreshes ...

I've made a small comments system, when I click to comment it goes to an "InsertComment" page but I need it to go back to the original page ...

    
asked by anonymous 23.06.2015 / 02:52

2 answers

9

You can do this in the following ways:

<a href="javascript:history.back()">Go Back</a>

or by using:

<script>
    document.write('<a href="' + document.referrer + '">Go Back</a>');
</script>
    
23.06.2015 / 02:56
3

If it is automatically, after the form is submitted, you will get to the page that object form will open next object code:

<body onload='window.history.back();'>
    
23.06.2015 / 10:17