I was having trouble until I put the iFrame in the index.html page. This makes me believe that it is an issue with this iframe.addEventListener("load" failing (race condition). My fix is to bind the LOAD event before appending it to the page with jQuery:
var $iframe = $('<iframe src="https://app.powerbi.com/reportEmbed?reportId=0&groupId=0"></iframe>');
$iframe.on("load", function() {
this.contentWindow.postMessage(JSON.stringify({ action: "loadReport", accessToken: token }),"*");
});
$("#root").append($iframe);
I was having trouble until I put the iFrame in the index.html page. This makes me believe that it is an issue with this
iframe.addEventListener("load"failing (race condition). My fix is to bind the LOAD event before appending it to the page with jQuery: