powerbi.bootstrap is a method introduced in Client SDK version 2.9.0 to help developers embed Power BI entities faster and get better performance.
Embedding a report using powerbi.embed requires multiple parameters, such as reportId, embedURL, and accessToken. These parameters aren't always immediately available.
powerbi.bootstrap allows you to start embedding before all the required parameters are available. The bootstrap API prepares and initializes the iframe.
After the required parameters are received, powerbi.embed(element, config) should be called on the same HTML element.
Bootstrap API
The powerbi.bootstrap(element, config) method receives an element and config, the same as powerbi.embed(...).
/**
* Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding.
*
* @param {HTMLElement} an HTML Element where you need to embed. must be the same div element you will use in powerbi.embed.
* @param {IBootstrapEmbedConfiguration} config: a bootstrap config.
*/
bootstrap(element: HTMLElement, config: IBootstrapEmbedConfiguration): embed.Embed;
type (required): The type of entity you want to embed, such as 'report', 'dashboard', 'tile', 'qna', or 'visual'.
hostname: If you don't have an embedURL yet, you can provide a hostname. The hostname is the domain name of the embed URL. For example, if the embed URL is 'https://app.powerbi.com/reportEmbed' then the hostname is 'https://app.powerbi.com/'. If no hostname or embedUrl is provided, the default hostname, https://app.powerbi.com/, is used.
embedUrl: The same embed URL you will provide later to powerbi.embed. If no hostname or embedUrl is provided, the default hostname, https://app.powerbi.com/, is used.
settings: To embed the report in a mobile layout or to provide a locale (language), include these parameters in the initial settings.
Bootstrap samples
The following samples provide a reference for the bootstrap method when embedding Power BI entities.
Note
Make sure that you call powerbi.embed after receiving the embed parameters.
Do you want to know how to work with Microsoft Power BI in Dynamics 365 Business Central? If so, this module is for you. You'll learn how to deploy Business Central dashboards in Power BI and how to set up Power BI inside Business Central.
Learn how to use the Power BI JavaScript API to embed a visual in an app. See which interface to use when you configure the visual. View code examples.
Learn how to handle events emitted by an embedded component in a Power BI embedded analytics application. See a full list of events and response values and view an example of handling an event.
Learn how to use the Power BI JavaScript API to embed a dashboard in an app. See which interface to use when you configure the dashboard. View code examples.