Javascript history back function redirects the user to the previous page visited by the user. History Back function of javascript performs the same action as the web browser back arrow button. But remember that javascript history back button works at client side that does not retrieve the updated version of web page if in the mean time original content of the web page changes on the server. Javascript history back function displays the cached version of the web page stored at client side.

Syntax for Javascript History Back Function

history.back();

or

window.history.back();

You can also use window object of javascript to access back the method of history object.

Example of Javascript History Back Function

<html>
<head>
    <title>Javascript History Object Back Function</title>
</head>
<body>
    <input
        id="btnBack"
        type="button"
        value="Back"
        onclick="history.back();" />
</body>
</html>

Above example creates a back button on the HTML page. onclick event is used to redirect the user to previous URL of the web browser history.

Continue to next tutorial: Javascript History Forward Function to learn how to navigate to next link using JavaScript function.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.