✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Dash-dangerously-set-inner-html in a multi page app

Hi all,

I am trying to leverage the custom component dash-dangerously-set-inner-html.

How can I render an inner html in a multi-page app. Seems to work correctly on a single-page app, but as soon as I try to render it in one of the pages of the multi-page app I’m working on, the layout won’t load.

In advance, thank you !

EDIT:

Answer: in a hidden div located in the index.py file, make a call to the component, like below:

html.Div(dash_dangerously_set_inner_html.DangerouslySetInnerHTML())

Then use it as usual in any of the other pages.

2 Likes

Hi,

Thank you for the post. I am encountering the same issue when building a two page app. I have added the Div suggested to the index page layout. However, the app is still not loading anything. Did you just add the line to any place in the layout?

I am using a similar multipage app design as shown in the following page:
https://dash.plot.ly/urls

Thanks!

Note that this bug was fixed in version 0.29.0 of dash (https://github.com/plotly/dash/blob/master/CHANGELOG.md#0290---2018-11-06)