Location Component

The dcc.Location component represents the location or address bar in your web
browser. Through its href, pathname, search and hash properties
you can access different portions of the url that the app is loaded on.

See the URLs & Multipage Apps chapter
for more details.

For example, given the url

  • href = ""
  • pathname = "/page-2"
  • search = "?a=test"
  • hash = "#quiz"

Access this documentation in your Python terminal with:


Our recommended IDE for writing Dash apps is Dash Enterprise’s
Data Science Workspaces,
which has typeahead support for Dash Component Properties.
Find out if your company is using
Dash Enterprise

id (string; required):
The ID of this component, used to identify dash components in
callbacks. The ID needs to be unique across all of the components
in an app.

hash (string; optional):
hash in window.location - e.g., “#myhash”.

href (string; optional):
href in window.location - e.g.,

pathname (string; optional):
pathname in window.location - e.g., “/my/full/pathname”.

refresh (boolean; default True):
Refresh the page when the location is updated?.

search (string; optional):
search in window.location - e.g., “?myargument=1”.