Embed Power BI content in WordPress

Advanced | Add your own JavaScript

Steps in this Topic

Many customers have asked whether they can manipulate the embedded content themselves directly using JavaScript. This is possible. The following code is a simplified example of how you can wait for the powerbi object to become available in the global window namespace and then toggle a report’s fullscreen mode.

var reportLoaded = window.setInterval(() => {
	if (window.powerbi && Array.isArray(window.powerbi.embeds)) {
		window.clearInterval(reportLoaded);
		window.powerbi.embeds[0].fullscreen();
	}
}, 100);

Happy coding!