History Object

In this chapter you will learn:

  1. How to use History object

Object of History

The history object represents the user's navigation history. The history object is a property of window. Each browser window, tab, and frame has its own history object.

It's not possible to determine the visited URLs. It is possible to navigate backwards and forwards.

The following table lists the properties and methods in history object.

NameDescriptionReturns
back()Goes one step back.void
forward()Goes one step forward.void
go(index)Goes to a position relative to the current document. Positive values are forward, negative are backward.void
lengthReturns the number of items in the history.number
pushState(state, title, url)Adds an entry to the browser history.void
replaceState(state, title, url)Replaces the current entry in the browser history.void
stateReturns the state data associated with the current document in the browser history.object

Next chapter...

What you will learn in the next chapter:

  1. How to use history back method
Home » Javascript Tutorial » History
History Object
history.back()
history.forward
history.go(url/number)
history.length
history.pushState