Code

Back to Previous Page Button

Add a back to previous page button to your Webflow site with this simple Javascript code snippet. When a user clicks on the button they'll be returned to the previous page they were visiting.

Back to Previous Page Button preview

Add a back to previous page button to your Webflow site with this simple Javascript code snippet. When a user clicks on the button they'll be returned to the previous page they were visiting.

How to add it

  1. Add Javascript code snippet to the closing body section of your custom code
  2. Update the class to the class name of your button

The code

Javascript
                      <!-- Add to closing body section -->
<script>
$( document ).ready(function() {
    $( ".goback" ).click(function() {
				window.history.back();
		});
});
</script>

                    

Browse similar code snippets

Language

More from Corey Moen

Profile →

Related Webflow questions

All answers →

Similar code snippets

All code snippets →