Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
cmgchess
New Member

What is the IFrame target origin for embedding PowerBI dashboard

 

I'm using the PowerBI REST API along with ADAL.js and getting Dashboards. I want to embed a Dashboard in an IFrame. I'm using Angular.JS
So what did was something like this. Notice I have used "*" as the IFrame Target Origin. dashboardEmbedUrl is obtained from the API call

<iframe id="PBDashboard" ng-show="dashboardVisible" src="{{dashboardEmbededUrl}}" frameborder="0" style="height: 100vh; width: 100%"></iframe>

and in my controller

var iframe = document.getElementById("PBDashboard")
const loadIframeDashboardEventListner = function() {
    const token = localStorage.getItem('adal.access.token.keyhttps://analysis.windows.net/powerbi/api');
    iframe.contentWindow.postMessage(JSON.stringify({
        action: "loadDashboard",
        accessToken: token
    }), "*") //target is *. what should be the specific URL needed here
}

and

iframe.addEventListener("load",loadIframeDashboardEventListner);

This works perfectly fine but using "*" triggers a security warning in SonarCloud. It says to specify a target. I'm not sure what the target should be. The API call also gives a webUrl along with the embedUrl. I used the webUrl instead of the "*" and it rendered the IFrame data but also gave the following error in console

 

e0EI6

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @cmgchess,

AFAIK, the basic embedded processing required token, permission, embed URL, embedded content id, and content type.

Understanding the different embedding solutions in Power BI embedded analytics | Microsoft Docs

I think this part may match with the 'embed URL' which you configure in the embed configurations.

In addition, you can also take a look at the following link about power bi embedded playground which shares the online sandbox with code snap if helps:

Power BI Playground - Developer Sandbox

Regards,

XIaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @cmgchess,

AFAIK, the basic embedded processing required token, permission, embed URL, embedded content id, and content type.

Understanding the different embedding solutions in Power BI embedded analytics | Microsoft Docs

I think this part may match with the 'embed URL' which you configure in the embed configurations.

In addition, you can also take a look at the following link about power bi embedded playground which shares the online sandbox with code snap if helps:

Power BI Playground - Developer Sandbox

Regards,

XIaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.