How to Go Back to the Home Page in Javascript?

6 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>

Popular Tutorials

Related Tutorials

How to Get the Index of a Value in an Array in JavaScript

In this lesson, we will see how to get the index of a value in an array in JavaScript, sometimes we...


How to Join Elements of an Array in JavaScript

In this lesson, we will see how to join elements of an array in JavaScript, sometimes we want to joi...


How to Check if an Array Includes a Value in JavaScript

In this lesson, we will see how to check if an array includes a value in JavaScript, sometimes we wa...


How to Remove a Specific Value from an Array in JavaScript

In this lesson, we will see how to remove a specific value from an array in JavaScript, sometimes we...


How to Add Value to an Existing Array in JavaScript

In this lesson, we will see how to add value to an existing array in JavaScript, sometimes we want t...


How to Remove Whitespace from a String in JavaScript

In this lesson, we will see how to remove whitespace from a string in JavaScript, sometimes we want&...


How to Remove Spaces from a String in JavaScript

In this lesson, we will see how to remove spaces from a string in JavaScript, sometimes we want to r...


How to Check if a String Starts with a Character in JavaScript

In this lesson, we will see how to check if a string starts with a desired character in JavaScript,...


How to Check if a String Contains a Substring in JavaScript

In this lesson, we will see how to check if a string contains a substring in JavaScript, sometimes w...


How Do you Check if a String ends with a Character in JavaScript

In this lesson, we will see how to check if a string ends with a desired character in JavaScript, so...