Showing results for 
Search instead for 
Did you mean: 
Not applicable

Power BI Report Server - Refresh data on embedded report

Hi -


Below, we have figured out the javascript code that can be pasted into the console to get a PowerBI Report Server report to refresh the data only (i.e. clicking the refresh button) on a timer. We can get this to work whether you are on the regular screen of the report server report or with it in the embed view, but not when it is actually embedded.


The use case would be to provide "real-time" data using report server so that these reports could be kept open, refreshed, and the dropdown choices stay as the user selected. 


Does anyone know how to get this code below to work when embedding a report on a website on an internal network?


Thank you!


function refreshPowerBI() {

this.frames[0].postMessage({kind:"powerbi.reportServerHost.IToolbarActionMessage",button:"refresh"},"https://[our report server]:443")



if(window.autoRefreshInterval) { clearInterval(window.autoRefreshInterval); };

window.autoRefreshInterval = setInterval(refreshPowerBI, 60*1000)

smithatravis Visitor

Re: Power BI Report Server - Refresh data on embedded report

You'd need to inject the script onto the page and call the function. I was able to get this working by using an iframe to host the inject call. You can do this by placing a custom html page in the wwroot folder of report server and then embedding the report into that html page. A sample of the code I used is below.


<!DOCTYPE html>
<html xmlns="">
<title>page title</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge;" />
<base href="/">
<meta charset="utf-8">
<meta name="description" content="">
<meta name="format-detection" content="telephone=no" />
<script src=""></script>
<script type="text/javascript">
$(document).ready(function () {
var frame = '<iframe src="your report url" id ="powerbiframe" name="powerbiframe" onLoad="injectJS()" runat="server" height="100%" width="100%" frameborder="0"></iframe>';

function injectJS() {
var iFrameHead = window.frames["powerbiframe"].document.getElementsByTagName("body")[0];
var myscript = document.createElement('script');
myscript.type = 'application/javascript';
myscript.src='dashrefresh.js';  //save your powerbirefresh function to a .js file in the same location as your html file

<div id="pbi-loading"></div>
<div id="reportcontainer" align="center">
<div id="framecontainer"></div>


Helpful resources

Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors