Here is the scenario. The user will be on index page("/index") initially and user has upload functionality here and as soon as upload(I know how to how check the process is done or not) is done I want automatic routing to another URL("/uploaded").
To read current URL, I know that we can use dcc.Location, but how to route to a new URL from current URL.
I am able to figure out. You just have to give a callback to a hidden div and return dcc.Location with updated pathname. here is my callback that worked. In code below I am checking if all files are uplaoded successfully and then routing to different URL(in my case routing from “/index” to “/newurl”.
@app.callback(
Output("temporary-store", "children"),
[Input('upload-data', 'contents')]
)
def display_page(contents):
if contents is not None:
return (dcc.Location(pathname="/newurl", id="something-id")
if I do refresh=false, it is not routing to new URL/page at all.
I am browsing through the forum and came across this. Will have to explore if it works.