Launching JavaScript function on page load


Is there any way to run a JS function on page load? I’ve been able to add scripts inside the layout using the html.Script type, but there doesn’t seem to be a way to add JS as text inside the app.scripts.append_scripts method - only to add JS files.

Out of curiosity, when you add scripts using html.Script(), were you able to get them to run? My understanding is that script elements inserted into the DOM via innerHTML (which I believe is what Dash is modifying) won’t be run by the browser.

See my comment here:

That was my experience; the scripts added via html.Script didn’t execute.

It looks like there is a PR out there already that would solve this

but the CI build failed.

@chriddyp do you have time to fix it?