Categories
JavaScript Answers

How to make an HTML back link with JavaScript?

Spread the love

To make an HTML back link with JavaScript, we call the history.back method on click.

For instance, we write

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

to set the href attribute to the JavaScript code that calls the history.back method to go back to the previous page when we click on the link.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *