beta
cables is under heavy development.
There might be one or another bug, please let us know about it!
LocationHashRoute
Ops.Website.LocationHashRoute
Namespace: Ops.Website
gives updated information about window.location.hash

summary (oneliner)

this will return information about window.location.hash (the part after the #) in your url.

these parts of the url can be changed without reloading the browserwindow and hence may be used to carry state.

this adheres to "getstring" syntax for key-value-pairs. having multiple # is also allowed. if key-value-pairs are duplicated the last one in the string "wins".

if you define a route, only parts of the hash that match this route will be considered. use multiple ops and multiple hashes to work with urls like this: "#/scene/1#/track/5".

additionally you may set a route like this "/scene/:number" and the op will extract "5711" from this hash #/scene/5711 and store it in the output object as "number".

doc

issues

youtube id

collections

related ops

Inputs

Route (String)

pattern for url and variables (i.e. /scene/:id)


Outputs

Values (Object)

an object of key-value-pairs as extracted from the hash


Changed (Trigger)

fires on change of the hash in the url


Matching (boolean Number)

Caught a mistake or want to contribute to the documentation?

Edit Documentationcancel save
LocationHash Example:

how to use the browser location bar to navigate and create deeplinks



Credits


  • Uses library: navigo (A simple dependency-free minimalistic JavaScript router)
  • Op author: stephan

Changelog


created op
2021-03-09 - cables

Ops.User.cables.LocationHash renamed to Ops.Website.LocationHash
2021-03-09 - stephan

Ops.Website.LocationHash renamed to Ops.Website.LocationHashRoute
2021-04-27 - pandur

Examples using LocationHashRoute

Public Patches using LocationHashRoute