JavaScript History API - Go Back Function

Understanding javascript:history.back()

The javascript:history.back() function is part of the JavaScript History API. It allows you to navigate to the previous page in the browser's session history, similar to clicking the browser's back button.

This method is commonly used to create custom "Go Back" buttons in web applications, providing a more seamless user experience.

How to Use history.back()

To implement a "Go Back" functionality in your web page, you can use the following code:

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

Or, you can use it in a JavaScript function:

function goBack() {
  window.history.back();
}

Browser Compatibility

The history.back() method is widely supported across modern browsers, including Chrome, Firefox, Safari, and Edge.

Return to Home Page

Go Back

✏️ Edit Page