Skip to content

Iframe on load failing - race condition #2

@getsetbro

Description

@getsetbro

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&amp;groupId=0"></iframe>');
$iframe.on("load", function() {
  this.contentWindow.postMessage(JSON.stringify({ action: "loadReport", accessToken: token }),"*");
});
$("#root").append($iframe);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions