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

Dash inside iframe, update component

Hi everyone,

I want to load my Dash dashboard (pageB) on an iframe from another page (pageA).
So pageB is inside an iframe of pageA.

Now I want to update a div from pageB when I click on a button of pageA.

I don’t know how to do it, so far here is what I tried :

<button type="button" id="test">Test</button>

<iframe id="dash-iframe" style="width: 100%; height: 800px;" src="http://localhost:8050"></iframe>

$( "#test" ).click(function() {
  $('#dash-iframe').contents().find('#my-id').addClass('test-class');
  return false;
});