Retrieving url parameters

My app is embedded in an iframe and I’m trying to retrieve the url parameters. I’m printing out the pathname within the callback that executes when dcc.Location changes url…

print(‘You are on page {}’.format(pathname))

However when I check the Heroku logs all I get is…

You are on page //

Even though I can see the correct url displaying in the component updates:

POST /_dash-update-component HTTP/1.1" 200 321 “”`

I’m using the latest versions of dash as I know there was a recent update to facilitate this. Am I missing something?

You might have already done this, but I find a sanity check never goes astray, just to make sure you really are using the version you think you are:

>>> import dash_core_components as dcc
>>> dcc.__version__

Yep always good to double check - “unfortunately” i’m using the latest version ‘0.15.5’

See the new search property to get the query parameters or the new href property to get everything. For usage, see this integration test:

1 Like

Thanks very much! Working now.

1 Like

Really? Href with parameters is not working for me. It works the first query and then it stops working.

For clarity, here is the documentation on the dcc.Location method which will allow you to easily get those parameters.

@chriddyp Is there any way, any way at all to get the current page’s url parameters without needing to retrieve it from an Input or by using a @app.callback()

I have a situation where going that route is an impossibility since I need to retrieve a url parameter in order to initially load my master dataframe which controls/defines the app layout (since the app layout/callbacks are defined after the dataframe is loaded, then any callback waiting on the dcc.Location Input would be defined after it was needed to load the df in the first place.)

1 Like

Hey agosta!

I’m also facing a similar situation. Were you able to resolve it?

Were you able to solve this?