Forum Discussion
JPHK
2 years agoFrequent Visitor
User Owns Data App - open report in new window
I've setup the sample user owns data app from Microsoft and all works well. However, rather than loading the report in a container on the same page as the report selection, I want it to load in a new...
- Anonymous2 years ago
Hi JPHK ,
Please modify your
embed.jsfile as below:// Get the report details from your application let reportId = '...'; let embedUrl = '...'; let accessToken = '...'; // Create a new window let reportWindow = window.open('report.html'); // Wait for the new window to load reportWindow.onload = function() { // Get the Power BI service object let powerbi = window.powerbi; // Embed configuration used to describe the what and how to embed let config = { type: 'report', tokenType: powerbi.models.TokenType.Embed, accessToken: accessToken, embedUrl: embedUrl, id: reportId, permissions: powerbi.models.Permissions.All, settings: { filterPaneEnabled: true, navContentPaneEnabled: true } }; // Get a reference to the embedded report HTML element let reportContainer = reportWindow.document.getElementById('reportContainer'); // Embed the report and display it within the div container let report = powerbi.embed(reportContainer, config); };Best Regards
Anonymous
2 years agoNot applicable
Hi JPHK ,
Please modify your embed.js file as below:
// Get the report details from your application
let reportId = '...';
let embedUrl = '...';
let accessToken = '...';
// Create a new window
let reportWindow = window.open('report.html');
// Wait for the new window to load
reportWindow.onload = function() {
// Get the Power BI service object
let powerbi = window.powerbi;
// Embed configuration used to describe the what and how to embed
let config = {
type: 'report',
tokenType: powerbi.models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: reportId,
permissions: powerbi.models.Permissions.All,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};
// Get a reference to the embedded report HTML element
let reportContainer = reportWindow.document.getElementById('reportContainer');
// Embed the report and display it within the div container
let report = powerbi.embed(reportContainer, config);
};
Best Regards
JPHK
2 years agoFrequent Visitor
Perfect. Thank you very much.