History.back()

JavaScript 1.0+, ECMAScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

history.back()

Description

The back() method of the History object is used to load the URL for the previously visited Web site.

Example

Listing 7.294 shows an example of how a JavaScript button can use the back() method to simulate the browser's back functionality.

Listing 7.294 Example of the back() Method
<html>
<head>
<title> Using the back method of the History object</title>
</head>
<body>

<form name=form1>
Click on the button to go back to the previous page.
<input type="button" value="Go Back" onClick='window.history.back()'>
</form>

</body>
</html>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.