Module Dom.History

Module representing the browser history.

type t
val go : int -> t -> unit
val push_state : Base.Value.t -> string -> string -> t -> unit

push_state state title url Push a new url onto the history stack without loading the page.

The title is ignored by many browsers.

The url can be relative or absolute. If its relative, it is resolved relative to the current url.

Precondition: url must be of the same origin as the current url.

The state is included in the corresponding popstate event as state property. The popstate event fires if the user navigates to the corresponding url.

Note: Neither push_state nor replace_state do trigger a popstate event. A popstate event is triggered only by navigation (back, forward button). At the popstate event the new location has already been set.

val replace_state : Base.Value.t -> string -> string -> t -> unit

Like push_state but without pushing a new state onto the history. Just replace the current entry in the history stack.