Skip to content

Preload

Amit Shuster edited this page Jan 24, 2021 · 4 revisions
ℹ️ This wiki has been deprecated
All our Client APIs documentation and references can be found in the new Power BI embedded analytics Client APIs documentation set.
For the content of this article see Use preload to reduce load time.

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.