JavaScript History back() Tutorial

In this section, we will learn what the History back() method is and how to use it in JavaScript.

JavaScript History back() Method: (Back button in browser)

Via this method, we can move backward to the previously visited URL in the current browser window. This method acts the same as the back button on the browser window.

Note: If there’s no previous visited URL in the history, the method won’t do anything.

History back() Method Syntax:

history.back()

History back() Method Parameter:

The method does not take an argument.

History back() Method Return Value:

The method does not return a value.

Example: go back to previous page

See the Pen go back to previous page by Omid Dehghan (@odchan1) on CodePen.

Leave a Reply