Access full pathname

I am using the dcc.location and updating the value of the pathname when a value from a dropdown is selected.

This works great
Output(‘this_url’, ‘pathname’),
inputs=[Input(‘my_dropdown’, ‘value’)])
def change_url(value: str) -> str:
local_url = f"/?value={value}"
return local_url

However, the problem is that when someone accesses from the url like this -> “” dash interprets the “?value=my_value” as part of the global pathname, so, when the callback is called by changing the value of the dropdown, I start getting this types of URLs -> “” … “

Any idea how to limit this to only one ?value=my_value . ???


Instead of pathname, I think you might want either the search or href props. Check out the docstring of Location for some more details.

using href made the job!


1 Like