Skip to content

Preload

Amit Shuster edited this page Apr 16, 2020 · 4 revisions

Use preload to reduce the load time of your embedded content, when your embedded content is in a different page.

powerbi.preload() is used to the download the necessary scripts prior to embedding your content. The browser will store these scripts in its cache making the initial call to powerbi.embed() faster. In order to use preload, you need to provide the type of the embedded entity, and a base URL for PowerBI Embedded (embed URLs without any specific URL parameters such as reportId and groupId)

// Building the config object
var config = {
    type: 'report',
    embedUrl: 'https://app.powerbi.com/reportEmbed',
};

var element = powerbi.preload(config);

A 'ready' event will be fired once the preload is completed.

element.on('preloaded', function() {
   // ...
});

Note: As a best practice for performance, instead of using preload, we recommended using bootstrap.