Module Brr.Loc

module Loc: sig .. end
Browser location

TODO. Needs redesign/review.

Warning. We use the terminology and return data according to RFC 3986, not according to the broken HTML URLUtils interface.

Location URI

val uri : unit -> Brr.str
uri () is the browser's location full URI.
val scheme : unit -> Brr.str
scheme () is the scheme of Brr.Loc.uri ().
val host : unit -> Brr.str
host () is the host of Brr.Loc.uri ().
val port : unit -> int option
port () is the port of Brr.Loc.uri ().
val path : unit -> Brr.str
path () is the path of Brr.Loc.uri ().
val query : unit -> Brr.str
query () is the query of Brr.Loc.uri ().
val fragment : unit -> Brr.str
fragment () is fragment of Brr.Loc.uri () with the hash.
val set_fragment : Brr.str -> unit
set_fragment frag sets the fragment of Brr.Loc.uri () to frag. This does not reload the page but triggers the Brr.Ev.hashchange event.
val update : ?scheme:Brr.str ->
?host:Brr.str ->
?port:int option ->
?path:Brr.str -> ?query:Brr.str -> ?fragment:Brr.str -> unit -> unit
update ~scheme ~hostname ~port ~path ~query ~fragment () updates the corresponding parts of the location's URI.

Location changes

val hashchange : Brr.str Note.event
hashchange occurs whenever the window's fragment changes with the new value of fragment ().
val set : ?replace:bool -> Brr.str -> unit
set replace uri sets to browser location to uri, if replace is true the current location is removed from the session history (defaults to false).
val reload : unit -> unit
reload () reloads the current location.