How to Go Back to the Home Page in Javascript?

8 months ago admin Javascript

In this tutorial, we will see how to go back to the home page in JavaScript, we will use a button, and once clicked we will go back to the home page.


Go back using Javascript

To do that, we will use the history.back() which is a javascript method that simulates clicking the browser back button.

                                                    
                                                                                                                
<button onclick="history.back()">
   Go back home
</button>

Related Tuorials

How to Check if a Tab is Active in JavaScript

In this lesson, we will see how to check if a tab is active in JavaScript, sometimes we want to know...


How to Add Multiple Data Types for Vue js Props

In this lesson, we will see how to add multiple data types for vue js props, sometimes when working...


How to Convert an Object to a Map in JavaScript

In this lesson, we will see how to convert an object to a map in JavaScript, sometimes we want to co...


How to Create an Array From a Map in JavaScript

In this lesson, we will see how to create an array from a map in JavaScript, sometimes we want to co...


How to Get a Key-Value Pair From a Map in JavaScript

In this lesson, we will see how to get a key-value pair from a map in JavaScript, sometimes we want...


How to Get the Keys of a Map in JavaScript

In this lesson, we will see how to get the keys of a map in JavaScript, sometimes we want to get all...


How to Get the Values of a Map in JavaScript

In this lesson, we will see how to get the values of a map in JavaScript, sometimes we want to get a...


How to Get the Size of a Map in JavaScript

In this lesson, we will see how to get the size of a map in JavaScript, sometimes we want to get the...


How to Remove a Value from a Map in JavaScript

In this lesson, we will see how to remove a value from a map in JavaScript, sometimes we want to rem...


How to Check if a Map Has a Value in JavaScript

In this lesson, we will see how to check if a map has a value in JavaScript, sometimes we want to ch...