Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have developed Power BI Charts by using Power BI Desktop, Sql Server db and Published it in to app.powerbi.com with my credentials, and then i get following URL by clicking on Publish to website.
The above url is working fine if i just copy paste that url in web browsers. but where as i used the same url with Angular Js Embeded API it was showing following error
Fetch API cannot load https://app.powerbi.com/view?r=eyJrIjoiYWRjNzA0OWMtMDE0MS00ZTE3LTkxZjgtYTJm…widCI6ImYyNzNhZTg0LTQxOT.... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:22668' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Can any one help me to resolve this error.
I am givning html and java script code which i used below.
html:
<html>
<head>
<title>Power BI - Sample</title>
<base path="/" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="styles/app.css" />
</head>
<body>
<div class="container">
<div id="reportstatic" class="powerbi-container"></div>
</div>
<script src="../bower_components/jquery/dist/jquery.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/3.3.0/es6-promise.js"></script>
<script src="../bower_components/fetch/fetch.js"></script>-->
<script src="../bower_components/powerbi-client/dist/powerbi.js"></script>
<script src="app/index.js"></script>
</body>
</html>
java script :
$(function () {
var models = window['powerbi-client'].models;
var staticReportUrl = 'https://app.powerbi.com/view?r=eyJrIjoiYWRjNzA0OWMtMDE0MS00ZTE3LTkxZjgtYTJmNzEzNjUzZWY5IiwidCI6ImYyN...';
var $staticReportContainer = $('#reportstatic');
var staticReport;
fetch(staticReportUrl)
.then(function (response) {
debugger;
if (response.ok) {
return response.json()
.then(function (embedConfig) {
staticReport = powerbi.embed($staticReportContainer.get(0), embedConfig);
});
}
else {
return response.json()
.then(function (error) {
throw new Error(error);
});
}
});
var $fullscreen = $('#fullscreen');
$fullscreen.on('click', function (event) {
staticReport.fullscreen();
});
Hi Mr.KumarDarmesh,
Thansk for your reply, but i didn't get solution for my problem with your link. Can any other way to resolve this problem.
Thanks in advance
Narendra
That looks to be a CORS issue which the stackoverflow article covers various options.
Which did you try ?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 8 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |