Retrieving url parameters


#1

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 “https://MY-APP.herokuapp.com//?user_id=14&user_name=Joe+Bloggs”`

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


#2

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__
'0.15.4'

#3

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


#4

See the new search property to get the query parameters or the new href property to get everything. For usage, see this integration test: https://github.com/plotly/dash-core-components/pull/131/files#diff-67ec2bf00b0a54c0fa8d06ee654230d5R330


#5

Thanks very much! Working now.