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

Location Properties

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.

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

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

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

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

refresh (a value equal to: ‘callback-nav’ | boolean; default True):
Use True to navigate outside the Dash app or to manually refresh a
page. Use False if the same callback that updates the Location
component is also updating the page content - typically used in
multi-page apps that do not use Pages. Use ‘callback-nav’ if you are
updating the URL in a callback, or a different callback will respond
to the new Location with updated content. This is typical with
multi-page apps that use Pages. This will allow for navigating to a
new page without refreshing the page.