Black Lives Matter. Please consider donating to Black Girls Code today.
Dash Enterprise delivers an incredible 21x cost savings 💸Download the e-book!

Document.title question

I am trying to use document.tilte to dynamically change the tittle of the app using the url as input.

Can I change document.title from inside a normal decorated callback?

I am using multi-page app, so I already have a decorated callback that changes the url based on the page. I would like to use that info that I put in the url to also update the page title.

Otherwise I will need to include the clientside callback and not use its output.

app.clientside_callback(
    """
    function(pathname) {
        document.title = pathname
    }
    """,
    Output('hidden-div', 'children'),
    [Input('url-output', 'pathname')]
)

Using a clientside callback with an unused output is the way to do this right now

1 Like