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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
bright
Helper I
Helper I

Is really no the other way embed powerbi dashboard in ifarme ?

Hello all , I have project need embed power bi dashboard in iframe is really no way can embed iframe ?

Can some one tell me have the other way can embed iframe ?

1 ACCEPTED SOLUTION

@bright

The answer to the thread subject would be NO.

Check this idea Allow PowerBI dashboards to be embedded via iframe and vote it up.

View solution in original post

8 REPLIES 8
bright
Helper I
Helper I

i embed powerbi dashboard in ifarme html but he not response 

著是demo
<?php
include('powerbi.php');//匯入我自訂的powerbi libery
$powerbi = new powerbi();
$report = $powerbi->report();
$report = json_decode($report);
$reportvalue = $report->value;
$access = $powerbi->token();
$token_type = $access->token_type;
$token = $access->access_token;
$dashbord = $powerbi->dashbord();
$dashbord = json_decode($dashbord);
$dashbord_value = $dashbord->value;
//$workspace = $powerbi->workspace();
?>
<input type="button" value="報告 &#10; report" onclick="report()">
<input type="button" value="儀錶 &#10; dashbord" onclick="dashbord()">

<iframe ID="iFrameEmbedReport" height="500px" width="900px"></iframe>
<input type='hidden' value="<?=$token?>" id="MainContent_accessToken">
<input type="hidden" value="<?=$reportvalue[0]->embedUrl?>" id="MainContent_ReportEmbedUrl">
<input type="hidden" value="<?=$dashbord_value[0]->embedUrl?>" id="DashbordUrl">


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript">
//This code is for sample purposes only.

//Configure IFrame for the Report after you have an Access Token. See Default.aspx.cs to learn how to get an Access Token
function report(){

if ("" != document.getElementById('MainContent_accessToken').value)
{
var iframe = document.getElementById('iFrameEmbedReport');

// To load a Report do the following:
// Set the IFrame source to the EmbedUrl from the Get Reports operation
iframe.src=document.getElementById('MainContent_ReportEmbedUrl').value;

// Add an onload handler to submit the access token
iframe.onload = postActionLoadReport;
}

}
function dashbord(){
if ("" != document.getElementById('MainContent_accessToken').value)
{
var iframe = document.getElementById('iFrameEmbedReport');
iframe.src=document.getElementById('DashbordUrl').value + "&width=800&height=500";
iframe.onload = postdashborad;




// Add an onload handler to submit the access token

}
}
// Post the access token to the IFrame
function postActionLoadReport() {

// Construct the push message structure
// this structure also supports setting the reportId, groupId, height, and width.
// when using a report in a group, you must provide the groupId on the iFrame SRC
var m = {
action: "loadReport",
accessToken: document.getElementById('MainContent_accessToken').value
};
message = JSON.stringify(m);

// push the message.
iframe = document.getElementById('iFrameEmbedReport');
iframe.contentWindow.postMessage(message, "*");;
}
function postdashborad(){


var m = { action: "loadTile" , accessToken: "<?=$token?>", height: 500 , width: 722 };
message = JSON.stringify(m);
iframe = document.getElementById('iFrameEmbedReport'); iframe.contentWindow.postMessage(message, "*");

}


</script>

  and wait too long time  after i check console he show error 

powerbiportal.dependencies.bundle.min.js:130 ReferenceError: powerBIAccessToken is not defined
    at r.setAuthorizationHeader (powerbiportal.common.bundle.min.js:40)
    at r.powerbiRequestOptions (powerbiportal.common.bundle.min.js:40)
    at i.Object.defineProperty.get [as requestOptions] (powerbiportal.common.bundle.min.js:37)
    at i.n.sendLongPollRequest (powerbiportal.common.bundle.min.js:37)
    at powerbiportal.common.bundle.min.js:37
    at powerbiportal.dependencies.bundle.min.js:170
    at e (powerbiportal.dependencies.bundle.min.js:59)
    at powerbiportal.dependencies.bundle.min.js:62

 after i search this problem too many people said not support this dashboard embed in iframe html . is really ?

My project need dashborad embed my html iframe 

here is my demo website http://atline.com.tw/admin/Power_BI/test.php

can help me this problem .

My powerbi dashborad can not embed in my iframe html . 

@bright

The answer to the thread subject would be NO.

Check this idea Allow PowerBI dashboards to be embedded via iframe and vote it up.

ok , thanks . i go vote .

Greg_Deckler
Community Champion
Community Champion

Are you saying you want to use Power BI Embedded in an iframe? If you want to use Power BI in an iframe, the easiest way is to use the "Publish to Web" feature and iframe the URL that it gives you.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Sorry , i look like mass up the english word 'embed' and 'embedded' . 

Not use report 

Do you know how to embed power bi dashboard in the html iframe ?

I means i wanna embed power bi " dashboards  " in html iframe not report . My project is use power bi not power bi embedded 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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