Black Lives Matter. Please consider donating to Black Girls Code today.

Update iframe src without flashing


I am using syntax like this to update an existing graph and then reload the new graph into the webpage:

#backend - python, update existing plot
plot_url = py.plot(data, filename=‘extend plot’, fileopt=‘extend’)
return url

//frontend - js, reload the iframe with the same url as before. Is there a better way of doing this??
document.getElementById(“graph”).src = url + “.embed”;

However, when it reloads, it does not load smoothly. The screen flashes white and it temporarily brings up the plotly webpage and then jumps back to mine. Is there a way to hide all this until the iframe has fully loaded?

This question doesn’t appear related to plotly.js.

You might have more chances to get a answer in #api/python or on stack overflow.